Re: adjusting the position of a line label string in a legend so that it can be centered whatever value of lgBoxMinorExtentF is used

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 31 2013 - 09:49:26 MST

Hi Marie-Dominique,

Dave may have a better answer about how to control the legend elements, but meanwhile, if you want that much control over your legend, I suggest creating it by hand, using calls to gsn_polyline_ndc and gsn_text_ndc (if you don't need to panel or resize the plots), or gsn_add_polyline and gsn_add_text (if you do need to resize or panel the plots)

If you draw the legend inside the plot, then you can draw the legend using data coordinates instead of NDC coordinates. This allows you to "attach" all the legend stuff to the plot.
This is useful if you plot to resize the plot later (like in a panel).

See the attached script, which draws a legend using NDC coordinates and gsn_xxx_ndc, and then data coordinates, using gsn_add_xxxx.

--Mary

On Jan 31, 2013, at 7:25 AM, leroux Marie-Dominique wrote:

> Hello,
>
> I'm trying to plot a legend on a "gsn_csm_xy" plot using the command:
>
> legend = create "Legend" legendClass wks
>
> provided in one of your your examples online (http://www.ncl.ucar.edu/Applications/Scripts/leg_5.ncl)
>
> specific important lines for me are:
> "lgItemType" : "Lines"
> "lgLineLabelStrings" : (/"", "", "NI", "PO", "PI","NO"/) ; line labels
> "lgLabelStrings" : (/" PV tendency", " Total PV flux", " Inward flux of Negative PV", " Outward flux of Positive PV", " Inward flux of Positive PV", " Outward flux of Negative PV"/) ; labels
> "lgBoxMinorExtentF" : 0.5 ; to shorten the legend lines
>
> because I wish to draw strings on each line plus a large legend at the right of each line, so I need to shorten the length of the lines.
> My concern is that, once I reduce the line length, line label strings are not centered on the lines anymore they stay at the right, see example attached) so that I can not shorten the lines more than using "lgBoxMinorExtentF" : 0.5 (e.g.: "lgBoxMinorExtentF" : 0.4 make line labels disappear).
>
> I noticed that the following commands:
> "lgAutoManage" : False ; to control the label font height directly
> "lgLabelJust" : "CenterLeft"
>
> make it possible to write the legend at the left of each line (instead of the right)
>
> Is there a similar command to adjust line label strings (such as "lgLineLabelJust" : "CenterCenter")? So that strings could be at the center of each line, whatever value of lgBoxMinorExtentF is used).
>
> Thank you very much for your kind help,
> Regards,
> Marie-Dominique LEROUX
> <Bilans_PV_305_350_theta_013106Z+00_60.ps>_______________________________________________
> 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 Thu Jan 31 09:49:35 2013

This archive was generated by hypermail 2.1.8 : Fri Feb 01 2013 - 15:31:04 MST