<div dir="ltr"><div><div>Hi Tabish,<br></div>The data array that you are passing in is dimensioned 49 x49. I think you want that to be dimensioned 2 x 49. Change this:<br><font face="trebuchet ms, sans-serif" color="#666666" size="2">data = new((/49,49/),"float")<br></font></div><font face="trebuchet ms, sans-serif" color="#666666" size="2">to this:</font><br><font face="trebuchet ms, sans-serif" color="#666666" size="2">data = new((/2,49/),"float")</font><div><br></div><div>(If you do not do that you will get 49 labeled legend lines.)<br></div><div><br></div><div>If that doesn't solve your issue or if you have further questions please respond to ncl-talk.<br></div><div>Adam<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 27, 2015 at 9:54 AM, Tabish Ansari <span dir="ltr"><<a href="mailto:tabishumaransari@gmail.com" target="_blank">tabishumaransari@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Hi<br><br></div><div>I am using the following script:<font face="trebuchet ms, sans-serif" color="#666666" size="2"><br><br><div class="gmail_default" style="font-family:trebuchet ms,sans-serif;display:inline">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br><br>begin<br> a = addfile ("<a href="http://consolidated_d04.nc" target="_blank">consolidated_d04.nc</a>","r")<br> wks = gsn_open_wks ("x11","xy") ; open workstation<br> res = True ; plot mods desired<br> res@tiMainString = "PM2.5 at Mandir Marg" ; add title<br>res@xyLineColors = (/"blue","red"/) ; change line color<br>res@xyDashPattern = 0 ; Make curves all solid<br>res@xyLineThicknesses = (/2.0,2.0/) ; make 2nd lines thicker<br>res@pmLegendDisplayMode = "Always" ; turn on legend<br>res@xyExplicitLegendLabels = (/"Sim.","Obs."/) ; create explicit labels<br><br>time = fspan(0, 48, 49)<br>data = new((/49,49/),"float")<br>PM25_sim = a->PM25(:,0,38,37)<br>PM25_obs = asciiread("PM2_5_MM.txt",(/49/),"float")<br>data(0,:)= PM25_sim<br>data(1,:)= PM25_obs<br> plot = gsn_csm_xy (wks,time,data,res) ; create plot<br>end<br><br><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><br></span></span></div><div class="gmail_default" style="display:inline"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif">However, I </span></span></div><div class="gmail_default" style="display:inline"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif">am not getting the desired legend names.<br><br></span></span></div><div class="gmail_default" style="display:inline"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif">Please help me out<br><br></span></span></div><div class="gmail_default" style="display:inline"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif">Thanks a lot<br><br></span></span></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif;display:inline"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif">Tabish</span></span></div><br><br><br><br>Tabish U Ansari<br>IBM Research India Laboratory<br></font></div><div><div><div dir="ltr"><div><div dir="ltr"><div><div><font face="trebuchet ms, sans-serif" color="#666666" size="2">New Delhi<br></font></div></div></div></div></div></div></div>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>