Thanks Adam.
That's great. It has taken me so much time to fix it yesterday. Changing
lgres@lgMarkerColors to lgLineColors fixed my problem. Thank you so much.
--Guo
From: ncl-talk-bounces@ucar.edu [mailto:ncl-talk-bounces@ucar.edu] On Behalf
Of Adam Phillips
Sent: Thursday, March 01, 2012 10:37 AM
To: ncl-talk@ucar.edu
Subject: Re: the legend order
Hello,
I think you are setting the wrong resource. Instead of setting
lgMarkerColors (which control the marker colors of the legend), try setting
lgLineColors. See example #8 here:
http://www.ncl.ucar.edu/Applications/legend.shtml#ex8
Adam
On 02/29/2012 11:34 PM, Guo Zhang wrote:
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
-- ______________________________________________________________ Adam Phillips asphilli@ucar.edu NCAR/Climate and Global Dynamics Division (303) 497-1726 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 1 11:30:55 2012
This archive was generated by hypermail 2.1.8 : Mon Mar 05 2012 - 14:12:07 MST