[ncl-talk] trouble making plot legend with a loop
Karin Meier-Fleischer
meier-fleischer at dkrz.de
Wed Aug 16 15:33:41 MDT 2017
Hi Adam,
change the following line in the loop from
>> plot@$tstr$ = gsn_add_text(wks,plot(1),plabel(n),xx(1),yy,res_text)
to
>> plot@$tstr$ = gsn_add_text(wks,plot(1),plabel(n),xx(1),yy(n),res_text)
Bye,
Karin
> Am 16.08.2017 um 22:52 schrieb Guido Cioni <guidocioni at gmail.com>:
>
> Hey Adam,
> I’m not sure whether it is right or not but it seems to me that the lines defining the plot area are thicker than they are supposed to. Are you by any change calling the draw(plot) twice, maybe by forgetting to set a false resource, advancing the frame or overlying different plots?
>
> Maybe the entire script would help, or at least the part where you’re setting the resources for the legend or calling the draw(plot).
>> Il giorno 16 ago 2017, alle ore 22:42, Adam Herrington <adam.herrington at stonybrook.edu> ha scritto:
>>
>> Hi all,
>>
>> I'm trying to come up with a routine thats produces a plot legend using a loop. However, my attempts to do so corrupts the text labels. See attached plot as an example. The code for this loop is:
>>
>> plabel = (/" ne30_old", \
>> " ne30_new", \
>> " ne60_old", \
>> " ne60_new", \
>> " ne120_old",\
>> " ne120_new",\
>> " ne240_old",\
>> " ne240_new"/)
>>
>> xx = (/1.,2.5/)
>> yy = (/985.,978.,971.,964.,957.,950.,943.,936./)
>> do n = 0,nfiles-1
>> res_lines at gsLineColor = colors(n)
>> lstr = unique_string("rum")
>> tstr = unique_string("hum")
>> plot@$lstr$ = gsn_add_polyline(wks,plot(1),xx,(/yy(n),yy(n)/),res_lines)
>> plot@$tstr$ = gsn_add_text(wks,plot(1),plabel(n),xx(1),yy,res_text)
>> end do
>>
>> Can anyone figure out why my legend labels are, what appears to be, 'doubly' printed?
>>
>> Adam
>> <Screen Shot 2017-08-16 at 2.31.25 PM.png>_______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170816/0b367658/attachment.html
More information about the ncl-talk
mailing list