[ncl-talk] legend

Mary Haley haley at ucar.edu
Sat Mar 17 13:11:42 MDT 2018


Sandro,

On the same legend page that Rick pointed you to, you could also check out
the "simple_legend" function that Adam Phillips created. Examples 16, 17,
and 19 show how to use this function.

If you need to draw the legend outside the plot, then simple_legend_ndc can
be used. This function has not yet been released, so I've attached it here.
You would need to load it with:

load "./simple_legend_ndc.ncl"

Examples 20 and 21 show how to use that function.

--Mary


On Sat, Mar 17, 2018 at 7:46 AM, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi,
>
> I now understand what you are saying. I'm not expert at this, but I wonder
> if pmLegendWidthF is the resource you need (http://ncl.ucar.edu/Document/
> Graphics/Resources/pm.shtml). There are several examples that explicitly
> set this at:
>
>     http://ncl.ucar.edu/Applications/legend.shtml
>
> If that does not help, please reply back to ncl-talk, as perhaps others
> with more experience can offer advise.
>
> Rick
>
> On Fri, Mar 16, 2018 at 10:06 PM, Vattioni Sandro <
> sandro.vattioni at outlook.com> wrote:
>
>> Hi Rick
>>
>> Thanks for your fast answer.
>> Attached I’m sending you a screen-shot.
>> I just want to decrease the length of the dash paterns in the legend. It
>> looks kind of silly when they are so long. I tried to draw the desired
>> outcome 😃
>>
>> Thank you very much for your help.
>>
>> Sandro
>>
>> *Von:* Rick Brownrigg <brownrig at ucar.edu>
>> *Gesendet:* ‎Freitag‎, ‎16‎. ‎März‎ ‎2018 ‎23‎:‎34
>> *An:* Vattioni Sandro <sandro.vattioni at outlook.com>
>> *Cc:* ncl-talk at ucar.edu
>>
>> Hi Sandro,
>>
>> Can you post a picture of what you talking about? I am having trouble
>> visualizing what the issue is... :-/
>>
>> Rick
>>
>> On Fri, Mar 16, 2018 at 9:15 PM, Vattioni Sandro <
>> sandro.vattioni at outlook.com> wrote:
>>
>>> Dear Madam or Sir
>>>
>>> I wnat to draw a legend for my xy-plot in ncl, but the dash patern of
>>> the line is very long compared to the text. I tried to make the dash
>>> pattern shorter with lgLineDashSegLenF but it did not work. How can I
>>> controll the length of the dash pattern using the legendClass?
>>>
>>> Kind regards,
>>> Sandro
>>>
>>> legend = create "Legend" legendClass wks
>>>    "lgTitleString"            : "Left Hand Side Column:
>>> 10~F34~0~F~N-10~F34~0~F~S emission"
>>>    "vpXF"                     : 0.2                  ; orientation on
>>> page
>>>    "vpYF"                     : 0.15  ;0.48
>>>    "vpWidthF"                 : 0.1 ;0.3                     ; width
>>>    "vpHeightF"                : 0.12                    ; height
>>>    "lgAutoManage"             : True
>>>    "lgPerimOn"                : False                   ; no perimeter
>>>    "lgItemCount"              : 5                      ; how many
>>>    "lgItemType"               : "Lines"
>>>    "lgLabelStrings"           : (/"Reference run","Continuous aerosol
>>> emission","Continuous
>>>    "lgLabelsOn"               : True                    ; no default
>>> lables
>>>    "lgLabelOffsetF"           : 0.0
>>>    "lgLineLabelFontHeightF"   : 2.0
>>>    "lgLineDashSegLenF"        : 0.01
>>>    "lgDashIndexes"            : (/0,0,0,0,0/)   ;4
>>>    "lgLineColors"             : (/"black","blue","red","darkvi
>>> olet","orange"/)
>>>
>>>  end create
>>>
>>>  draw(legend)
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180317/3dd4548f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple_legend_ndc.ncl
Type: application/octet-stream
Size: 5497 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180317/3dd4548f/attachment.obj>


More information about the ncl-talk mailing list