[ncl-talk] Legend as a break in curve in a time-series plot

Tabish Ansari tabishumaransari at gmail.com
Wed Nov 14 16:55:07 MST 2018


Hi Adam,

Thanks. It worked.
Only issue was that since the 10 lines have a different maximum value and
the y-axis was set according to the
first plot (line 1) while rest of them were overlayed on it, some of them
were cut at the top. This was fixed
when I explicitly set the y axis limits (res at trYMaxF =  50). The resultant
plot looks nice.

There were some warnings though:
warning:NhlDraw: cannot draw Plot Member, ID 71, independently
warning:NhlDraw: cannot draw Plot Member, ID 112, independently
warning:NhlDraw: cannot draw Plot Member, ID 59, independently
warning:NhlDraw: cannot draw Plot Member, ID 29, independently
warning:NhlDraw: cannot draw Plot Member, ID 163, independently
warning:NhlDraw: cannot draw Plot Member, ID 204, independently
warning:NhlDraw: cannot draw Plot Member, ID 245, independently
warning:NhlDraw: cannot draw Plot Member, ID 156, independently
warning:NhlDraw: cannot draw Plot Member, ID 243, independently

Does this only refer to the rest of the 9 plots which were overlayed?
Or is it something to worry about?

Cheers,

Tabish
I got some warnings though:

Tabish U Ansari
PhD student, Lancaster Environment Center
Lancaster Univeristy
Bailrigg, Lancaster,
LA1 4YW, United Kingdom


On Wed, 14 Nov 2018 at 23:02, Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Tabish,
> To set xyLineDashSegLenF individually for each line, you would have to
> plot each line individually, and overlay lines 2-10 back onto the plot
> created for line 1:
>
> res = True
> res at gsnDraw = False
> res at gsnFrame = False
> plot = new(10,graphic)
> tt = fspan(.5,.9,10)    ; you will likely want to modify this
> do gg = 0,9
>     res at xyLineDashSegLenF = tt(0)
>     plot(gg) = gsn_csm_xy(wks,x,arr(gg,:),res)
>     if (gg.ge.1) then
>        overlay(plot(0),plot(gg))
>     end if
> end do
>
> Adam
>
> On Wed, Nov 14, 2018 at 3:54 PM Tabish Ansari <tabishumaransari at gmail.com>
> wrote:
>
>> Hi Adam,
>>
>> Thanks.
>>
>> Since all the 10 lines are supplied to a single gsn_csm_xy which has only
>> one "res", how can I assign a different res at xyLineDashSegLenF for each
>> line?
>> Can I supply it as an array?
>> Is that possible?
>>
>> Cheers,
>>
>> Tabish
>> Tabish U Ansari
>> PhD student, Lancaster Environment Center
>> Lancaster Univeristy
>> Bailrigg, Lancaster,
>> LA1 4YW, United Kingdom
>>
>>
>> On Wed, 14 Nov 2018 at 22:34, Adam Phillips <asphilli at ucar.edu> wrote:
>>
>>> Hi Tabish,
>>> Yes, see:
>>>
>>> http://www.ncl.ucar.edu/Document/Graphics/Resources/xy.shtml#xyLineDashSegLenF
>>> Try a value around .5. The higher the value the more space between
>>> labels on an individual line.
>>> Adam
>>>
>>> On Wed, Nov 14, 2018 at 3:26 PM Tabish Ansari <
>>> tabishumaransari at gmail.com> wrote:
>>>
>>>> Thanks, it worked.
>>>>
>>>> The only issue now is that since I have 10 lines within a single xy
>>>> plot, it leads to
>>>> several labels overlapping with each other because they're labelled
>>>> exactly at the
>>>> same length intervals.
>>>>
>>>> Long shot but any chances that the user can control this spacing where
>>>> the labels are
>>>> written out for each line?
>>>>
>>>> Thanks
>>>>
>>>> Tabish
>>>> Tabish U Ansari
>>>> PhD student, Lancaster Environment Center
>>>> Lancaster Univeristy
>>>> Bailrigg, Lancaster,
>>>> LA1 4YW, United Kingdom
>>>>
>>>>
>>>> On Wed, 14 Nov 2018 at 22:16, Adam Phillips <asphilli at ucar.edu> wrote:
>>>>
>>>>> Hi Tabish,
>>>>> A good find with xy_14.ncl
>>>>> <http://www.ncl.ucar.edu/Applications/Scripts/xy_14.ncl>, but it
>>>>> looks to me like xyExplicitLabels allows one to put in an array of strings.
>>>>> Thus, did you try something like this: res at xyExplicitLabels = (/"Line
>>>>> 1","Line 2"/)
>>>>> Adam
>>>>>
>>>>> On Wed, Nov 14, 2018 at 2:54 PM Tabish Ansari <
>>>>> tabishumaransari at gmail.com> wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I think there's an example on the ncl webpage : xy_14.ncl
>>>>>> but it only explains how to label a single line. I have got 10 lines
>>>>>> in my plot and want to label them as run1, run2, run3.....run10, for
>>>>>> example.
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Tabish
>>>>>> Tabish U Ansari
>>>>>> PhD student, Lancaster Environment Center
>>>>>> Lancaster Univeristy
>>>>>> Bailrigg, Lancaster,
>>>>>> LA1 4YW, United Kingdom
>>>>>>
>>>>>>
>>>>>> On Wed, 14 Nov 2018 at 21:01, Tabish Ansari <
>>>>>> tabishumaransari at gmail.com> wrote:
>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> I'm creating a time-series plot with 10 curves within it.
>>>>>>> It is difficult to select 10 different colors for these 10 curves
>>>>>>> and then create a corresponding legend, which will also take a lot of
>>>>>>> extra space in the plot.
>>>>>>>
>>>>>>> Is there a way I can just name these curves as a break in them, just
>>>>>>> like
>>>>>>> when you use numbered contours in a contour plot?
>>>>>>>
>>>>>>> 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
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Adam Phillips
>>>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>>>
>>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>>
>>>>
>>>
>>> --
>>> Adam Phillips
>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>
>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>
>>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181114/dacd7cf8/attachment.html>


More information about the ncl-talk mailing list