Re: How to prevent legend labels sorting automatically

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 04 2011 - 22:03:21 MST

Hi Xianxiang,
NCL does not sort the given labels, it just plots them from bottom to top
(by default). Thus, your first label will be plotted at the bottom, with
the second label plotted right above the first. You can alter the order
that the labels are plotted by using lgItemOrder as is shown in example 9
here:
http://ncl.ucar.edu/Applications/legend.shtml#ex9
Adam

> Hello all,
>
> I am plotting some data using gsn_csm_xy and would like to add legend
> to the plot. Below is the related resources I set for this purpose:
>
> ; add a legend
> res@pmLegendDisplayMode = "Always" ; turn on legend
>
> res@pmLegendSide = "Right" ; Change location
> of
> res@pmLegendOrthogonalPosF = -0.15 ; more neg = down
>
> res@pmLegendWidthF = 0.12 ; Change width and
> res@pmLegendHeightF = 0.25 ; height of legend.
> res@lgLabelFontHeightF = .02 ; change font
> height
> res@lgPerimOn = False ; no box around
> ; labels for the legend
> res@xyExplicitLegendLabels = (/"RN","SH","LH","Ground"/)
>
>
> However, in the output plot, the legend labels were automatically
> sorted alphabetically, i.e., "Ground", "LH", "SH", "RN". This is not
> what I want. I need the legend appears in the original order I
> provided Anyone can provide some idea how to achieve this? Many
> thanks.
>
> Regards,
>
> Xianxiang
> _______________________________________________
> 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
Received on Tue Jan 4 22:03:29 2011

This archive was generated by hypermail 2.1.8 : Thu Jan 13 2011 - 09:24:21 MST