Dear Youngzuo,
You can't turn on legends for a map automatically. You need to use
gsn_create_legend and gsn_add_annotation to create the legend and
then attach it to the plot.
See the attached NCL script and PNG image. (I removed some of your
resource settings just to simplify the script. You can certainly put
the resource settings back in.)
Would it be okay if I add this example to our "annotations" page at:
http://www.ncl.ucar.edu/Applications/annotate.shtml
?
--Mary
On Jan 6, 2010, at 3:46 PM, Li, Yongzuo wrote:
>
> Hi Dennis,
>
> Example 10 works well for non-map. For map case, I got
>
> warning:PlotManagerSetValues: Legend annotation cannot be added
> after NhlCreate
> warning:lgPerimOn is not a valid resource in map.PlotManager at
> this time
> warning:xyExplicitLegendLabels is not a valid resource in map at
> this time
>
> Yongzuo
>
> See:
> http://www.ncl.ucar.edu/Applications/legend.shtml
> Example 10
> On 01/06/2010 12:43 PM, Li, Yongzuo wrote:
>
> I have problem to put legend at desired location. The script is like
>
> ; legend resources
> res@pmLegendDisplayMode = "Always"
>
> res@pmLegendSide = "Bottom"
>
> res@pmLegendZone = 0.
>
> res@pmLegendOrthogonalPosF = .01
>
> res@lgJustification = "BottomRight"
>
> res@pmLegendWidthF = 0.15
>
> res@pmLegendHeightF = 0.20
>
> res@lgPerimOn = False
>
> res@xyExplicitLegendLabels = (/"Best track",
> "Hybrid","pureGFS","3DVAR"/)
>
> res@lgLabelFontHeightF = 0.02
>
> plot = gsn_xy(wks,x,y,res) ; create plot
>
>
>
> My plot is the link
>
> ftp://ftp.caps.ou.edu/users/yli/ike-minslp.pdf
>
>
>
> I just want to put legend at lower-right corner.
>
>
>
> Thanks.
>
>
>
> Yongzuo
>
> ________________________________________
>
> From:
> ncl-talk-bounces@ucar.edu [ncl-talk-bounces@ucar.edu] on behalf of
>
> ncl-talk-request@ucar.edu [ncl-talk-request@ucar.edu]
>
> Sent: Wednesday, January 06, 2010 1:00 PM
>
> To:
> ncl-talk@ucar.edu
>
> Subject: ncl-talk Digest, Vol 74, Issue 13
>
>
>
> Send ncl-talk mailing list submissions to
>
> ncl-talk@ucar.edu
>
>
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
>
> xyExplicitLegendLabels is not a valid resource in map at this time
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Wed Jan 06 2010 - 17:07:09 MST