Re: trick for hiding lines in legend

From: mark collier <Mark.Collier_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 18 2012 - 21:10:25 MDT

Hi Mary/Rick,
yes Mary's solution is the best as it offers the most flexibility. However, I was a little surprised that I couldn't get a white box to block out the unwanted legend items as for my case it will be adequate as the build in legend feature is generally quite adequate and only needs minor tweaking.

As I was also panelling, it was quite tricky to get the legend text of similar size between the panels and also the line lengths of similar size - in the end it was a compromise via the attributes:

  lgres@vpHeightF = 0.15 ; height of legend (NDC)
  lgres@vpWidthF = 0.17 ; width of legend (NDC)
  lgres@lgLabelFontHeightF = 0.15 ; Change the font size

Many thanks,
Mark.

On 19/07/2012, at 2:25 AM, Mary Haley wrote:

> Hi Mark and Rick,
>
> I thought changing a legend should be as easy as using the lgLineColors resource. But, when you use the built-in legend that comes with an XY plot, most of the legend resources are "turned off" and hence you can't change them. There's something called the "PlotManger" which is taking control of the legend here.
>
> If you want to customize the lines in your legend, especially in the sense of turning individual ones on or off, then you will need to *not* use this built-in legend, and instead create one yourself and attach it to the plot.
>
> Please see example 8, which shows you how to create the legend using gsn_create_legend, and then how to attach it using gsn_add_annotation.
>
> You can look at example 13, which is more complicated. It queries the XY plot for you, and attemps to construct the legend from scratch. It also allows you to pick how many legend items to display, but it starts with the first one and works from there. You would have to modify it to indicate that you want to keep the last two.
>
> --Mary
>
> On Jul 18, 2012, at 9:35 AM, Rick Brownrigg wrote:
>
>> Hi Mark,
>>
>> I don't know for certain without seeing your script and playing around with it, but one thing that comes to mind is to define the black line colors as completely transparent, such as (/ 0., 0., 0., 0. /) (assumes you are using 6.1.0b). Are you using the lgLineColors resource to specify line colors of the legend?
>>
>> Hope that helps…
>> Rick
>>
>> On Jul 18, 2012, at 2:15 AM, mark collier wrote:
>>
>>> Hi,
>>> wondering if there is a "cheap trick" for hiding the black-lines in the legend when using the built in legend feature? Setting the line to white wouldn't work as it would white out the time-series - and my attempt to put a white box over them failed although should work in principle but requires tweaking. One option might be to define a line type that has no "dashes" and use it?
>>> Thanks for any advice,
>>> Mark.
>>>
>>> <PastedGraphic-2.tiff>
>>> _______________________________________________
>>> 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
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 18 21:10:39 2012

This archive was generated by hypermail 2.1.8 : Tue Jul 24 2012 - 09:48:26 MDT