Hi,
When I set up the legend, I have a strange problem. The lables of legend are supposed to match with the colors, ie LE_OBS: red, LE_CTL: green,LE_BT: black. But I got a disordered legend. Please see the attached file.
And the script is as below.
How can I fix the problem? Thanks.
wks = gsn_open_wks ("pdf","200907_LE") ; open workstation
res = True ; plot mods desired
; res@xyMarkLineModes = "MarkLines"
res@xyMarkLineModes = "Lines"
res@xyDashPattern = 0 ; Make curves all solid
; res@xyMarkers = 6
; res@xyMarkerSizeF = 0.005
; res@xyMarkerColors =(/"blue"/)
res@trYMinF = 0
res@trYMaxF = 300
res@xyLineColors = (/"red"/)
res@tiMainString = "Monthly Mean Flux Daily Variation" ; add title
res@tiXAxisString = "Time"
res@tiYAxisString = "Latent Heat Flux(W/m~S~2~N~)"
res@gsnDraw = False
res@gsnFrame = False
plot0 = gsn_csm_xy(wks,t0,LE_OBS,res) ; create plot
res@xyLineColors = (/"green"/)
plot1 = gsn_csm_xy(wks,t,m,res)
res@xyLineColors = (/"black"/)
plot2 = gsn_csm_xy(wks,t,n,res)
overlay(plot0,plot1)
overlay(plot0,plot2)
lgres = True
colors = (/"red","green","black"/)
lgres@lgMarkerColors = colors
lgres@lgItemType = "lines"
; lgres@lgMonoMarkerIndex = True
; lgres@lgMarkerIndex = 4
; lgres@lgMarkerSizeF =0.005
lgres@vpWidthF = 0.13
lgres@lgLabelFontHeightF =.08
lgres@vpHeightF = 0.10
lgres@lgPerimOn = False
; lgres@lgPerimThicknessF = 2.
lgres@lgMonoDashIndex = True
lgres@lgDashIndex = 0
; labels = (/"LE_BT","LE_OBS","LE_CTL"/)
labels = (/"LE_OBS","LE_CTL","LE_BT"/)
legend = gsn_create_legend(wks,3,labels,lgres)
amres = True
amres@amJust = "ToPLeft"
amres@amParallelPosF = -0.5
amres@amOrthogonalPosF = -0.5
; amres@amPerimOn = False ; turn off box around
annoid = gsn_add_annotation(plot0,legend,amres)
draw(plot0)
frame(wks)
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Mon Mar 05 2012 - 14:12:07 MST