[ncl-talk] create fewer explicit legend labels in xy-plot

Adam Phillips asphilli at ucar.edu
Wed Jun 20 17:46:50 MDT 2018


Hi Tabish,
Take a look at simple_legend:
https://www.ncl.ucar.edu/Document/Functions/Shea_util/simple_legend.shtml

You can completely control the legend creation this way, and therefore can only draw the legend items that you want.
Hope that helps!
Adam

> On Jun 20, 2018, at 5:23 PM, Tabish Ansari <tabishumaransari at gmail.com> wrote:
> 
> Hi Rashed,
> 
> Thanks for your reply.
> 
> I tried your suggestion but as we might expect, it still drew the all the legend lines - 3 with labels and rest without any label.
> In my case I just want 3 legends.
> 
> Let me know if there's a way to do that.
> 
> Cheers,
> 
> Tabish
> 
> Tabish U Ansari
> PhD student, Lancaster Environment Center
> Lancaster Univeristy
> Bailrigg, Lancaster, 
> LA1 4YW, United Kingdom
> 
>> On 20 June 2018 at 23:38, Rashed Mahmood <rashidcomsis at gmail.com> wrote:
>> Easiest "tric" would be to set:
>> res at xyExplicitLegendLabels = (/"obs","baseline","pulse","","","","","","","","",""/) 
>> 
>> Does this work? There are several other ways to get this done, let me know if this does not work.
>> 
>> 
>> 
>>> On Wed, Jun 20, 2018 at 1:26 PM, Tabish Ansari <tabishumaransari at gmail.com> wrote:
>>> Hi
>>> 
>>> I have a time-series with 12 different datasets plotted together in a single xy plot.
>>> 
>>> The color looks something like:
>>> res at xyLineColors      = (/"black","blue","red","red","red","red","red","red","red","red","red","red" /)
>>> 
>>> And the labeling is currently:
>>> res at xyExplicitLegendLabels = (/"obs","baseline","pulse18","pulse19","pulse20","pulse21","pulse22","pulse23","pulse24","pulse25","pulse26","pulse27"/) 
>>> 
>>> However, I do not want all the labels. Since all the "pulse" data are red in color, I just want to draw a single red legend with a name "pulse".
>>> If I do something like: res at xyExplicitLegendLabels = (/"obs","baseline","pulse"/) , NCL still uses default legend names for all the remaining data.
>>> I do not want that. Is there a way to only draw 3 legends when the data itself has more than 3 arrays within it?
>>> 
>>> Thanks
>>> 
>>> Tabish
>>> 
>>> 
>>> Tabish U Ansari
>>> PhD student, Lancaster Environment Center
>>> Lancaster Univeristy
>>> Bailrigg, Lancaster, 
>>> LA1 4YW, United Kingdom
>>> 
>>> _______________________________________________
>>> 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/20180620/7120dc51/attachment.html>


More information about the ncl-talk mailing list