[ncl-talk] Filling area between curve and x-axis in xy2 plot

Adam Phillips asphilli at ucar.edu
Wed May 25 14:59:06 MDT 2016


Hi Guido,
I will file a JIRA ticket for this issue; I am guessing you are the first
one to report it.

I tried a variety of ways to get the filled curve to get drawn after the
regular curves to no avail. If you need to have your axes the original way
you had them I think your idea of drawing a polygon is a good one. See the
first draw order example here:
http://www.ncl.ucar.edu/Applications/draworder.shtml#ex1
You would make the bottom of your polygon equal to your set YRefLine, in
this case = 0.
Adam


On Wed, May 25, 2016 at 2:26 PM, Guido Cioni <guidocioni at gmail.com> wrote:

> I already thought of swapping the axes. That made the trick indeed,
> although I would have preferred to keep fluxes axis on the left and Qnet on
> the right.
> Thank you!
>
> P.S. Any plans about controlling the Draw Order in xy2 plots in the
> future?
>
> Guido Cioni
> http://guidocioni.altervista.org
>
>
>
>
> Il giorno 25 mag 2016, alle ore 22:13, Adam Phillips <asphilli at ucar.edu>
> ha scritto:
>
> Hi Guido,
> I tested your code here and am seeing what you are seeing. I did get it to
> work though by changing the order of the plots in gsn_csm_xy2. So, try
> changing this:
> plot(j)=gsn_csm_xy2(wks,time,data,data2,res,res2)
> to this:
> plot(j)=gsn_csm_xy2(wks,time,data2,data,res2,res)
> Let ncl-talk know if that does not work for you.
> Adam
>
> On Wed, May 25, 2016 at 3:19 AM, Guido Cioni <guidocioni at gmail.com> wrote:
>
>> Dear all,
>> I’ve been trying to produce a simple xy2 plot with two lines and a
>> filled curve. The problem is that the latter, which is drawn together with
>> the curve in the second y axis, cover the other two lines. I tried to play
>> around with the resources xyCurveDrawOrder and tfPolyDrawOrder but
>> nothing did the trick. I think that there is no special resource that
>> controls the draw order of elements in xy2 plots, thus the second curve is
>> always drawn on top of the others.
>> Is there any other way to achieve the same results? Maybe using polyline
>> ?
>> Attached you find a snippet of the code (only the relevant part) and the
>> resulting plot.
>>
>>  do j=0,dimsizes(case)-1
>>
>>  plot=new(dimsizes(case), graphic)
>>  poly=new(dimsizes(case), graphic)
>>  wks   = gsn_open_wks ("pdf",”tserie")                ; open workstation
>>  res                  = True                     ; plot mods desired
>>  res at xyDashPatterns=(/0,0/)
>>  res at xyLineThicknessF=(/3,3/)
>>  res at xyLineColors=(/"blue","red”/)
>>
>>    data= (/lhflx, shflx/)
>>    data2 = qnet
>>
>>    res2= True
>>    res2 at gsnDraw = False
>>    res2 at gsnFrame = False
>>    res2 at xyLineColor = "gold"
>>    res2 at gsnYRefLine           = 0.0
>>   res2 at gsnAboveYRefLineColor = “lightyellow"
>>
>>   plot(j)=gsn_csm_xy2(wks,time,data,data2,res,res2)
>>
>> delete([/lhflx, shflx, serie, time, data /])
>>  end do
>>
>> plnres = True
>> gsn_panel(wks,plot,(/3,1/),plnres)
>>
>>
>> Guido Cioni
>> http://guidocioni.altervista.org
>>
>>
>> _______________________________________________
>> 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160525/0e2b151c/attachment.html 


More information about the ncl-talk mailing list