[ncl-talk] adding legends to xy plot
Tabish Ansari
tabishumaransari at gmail.com
Thu Aug 27 09:54:20 MDT 2015
Hi
I am using the following script:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
a = addfile ("consolidated_d04.nc","r")
wks = gsn_open_wks ("x11","xy") ; open workstation
res = True ; plot mods desired
res at tiMainString = "PM2.5 at Mandir Marg" ; add title
res at xyLineColors = (/"blue","red"/) ; change line color
res at xyDashPattern = 0 ; Make curves all solid
res at xyLineThicknesses = (/2.0,2.0/) ; make 2nd lines thicker
res at pmLegendDisplayMode = "Always" ; turn on legend
res at xyExplicitLegendLabels = (/"Sim.","Obs."/) ; create explicit
labels
time = fspan(0, 48, 49)
data = new((/49,49/),"float")
PM25_sim = a->PM25(:,0,38,37)
PM25_obs = asciiread("PM2_5_MM.txt",(/49/),"float")
data(0,:)= PM25_sim
data(1,:)= PM25_obs
plot = gsn_csm_xy (wks,time,data,res) ; create plot
end
However, I
am not getting the desired legend names.
Please help me out
Thanks a lot
Tabish
Tabish U Ansari
IBM Research India Laboratory
New Delhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150827/3a5ece3b/attachment.html
More information about the ncl-talk
mailing list