[ncl-talk] trouble making plot legend with a loop

Guido Cioni guidocioni at gmail.com
Wed Aug 16 14:52:56 MDT 2017


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



More information about the ncl-talk mailing list