[pyngl-talk] Fill color between 2 lines with Ngl.xy

Fearon, Dr. Matthew, Contractor, Code 7533 matthew.fearon.ctr at nrlmry.navy.mil
Fri Aug 31 09:24:55 MDT 2018


Thanks, Mary. I retried my script this morning and, with the cnFillDrawOrder=”PreDraw” on the contouring, FillColors now works for me in Ngl.xy overlay. Thank you also for the nice example scripts.

Matt


From: Mary Haley [mailto:haley at ucar.edu]
Sent: Thursday, August 30, 2018 5:10 PM
To: Fearon, Dr. Matthew, Contractor, Code 7533
Cc: pyngl-talk at ucar.edu
Subject: Re: [pyngl-talk] Fill color between 2 lines with Ngl.xy

Sorry, the minute I sent this I realized I had cut off the X axis title from the bottom plot. I've attached a better script and image (I hope).

--Mary


On Thu, Aug 30, 2018 at 6:06 PM, Mary Haley <haley at ucar.edu<mailto:haley at ucar.edu>> wrote:
I think the simple answer is that you need to make sure the contour fill draw happens before the XY fill happens.

res.cnFillDrawOrder = "PreDraw"

There are three phases that various aspects of the plots get drawn in: "PreDraw", "Draw" and "PostDraw".

If you make sure the contour fill draw happens in the "Predraw" phase, and the XY fill in the "PostDraw" phase, then it should work.

If both things fall in the PostDraw phase, then I'm not exactly sure what the ordering is of those elements.

I've attached a sample program and PNG file (which is not very interesting because it uses dummy data).

--Mary


On Thu, Aug 30, 2018 at 4:57 PM, Mary Haley <haley at ucar.edu<mailto:haley at ucar.edu>> wrote:
Hi Matt,

I'm looking into this one; I don't think we have an example in our gallery, but I'll try to create one to see if it works.

--Mary


On Fri, Aug 24, 2018 at 12:06 PM, Fearon, Dr. Matthew, Contractor, Code 7533 via pyngl-talk <pyngl-talk at ucar.edu<mailto:pyngl-talk at ucar.edu>> wrote:
Just a follow-up. I have learned that fill color between 2 adjacent lines with Ngl.xy works nicely for an exclusive xy plot. However, it does not work as an overlay to a contour plot when sfXArray/sfYArray or sfYCStart/End/ and sfXCStart/End are used in the original contour plot.  Individual xy lines with Ngl.xy can be overlain on a contour plot with no trouble, but fill color between them does not work.

Any help on this subject would be great.
Thanks,
Matt


From: pyngl-talk [mailto:pyngl-talk-bounces at ucar.edu<mailto:pyngl-talk-bounces at ucar.edu>] On Behalf Of Fearon, Dr. Matthew, Contractor, Code 7533 via pyngl-talk
Sent: Thursday, August 23, 2018 12:28 PM
To: pyngl-talk at ucar.edu<mailto:pyngl-talk at ucar.edu>
Subject: [pyngl-talk] Fill color between 2 lines with Ngl.xy

Hi, PyNGL Users,

I’m trying to indicate the terrain profile on the attached cross section plot. I am able overlay an xy line (black, terrain top) and another xy line (red, ground surface), but am unable to fill color between these two lines. All the combinations I have tried are not working. Below is my Ngl.xy code for the overlay. Any help is greatly appreciated.

Thanks,
Matt

-----
xvar[100] is a np array of the xvalues
pter[2,100] is a np array of the yvalues

    xyres                        = Ngl.Resources()
    xyres.nglFrame               = False
    xyres.nglDraw                = False
    xyres.xyLineColors           = ["black","red"]
    xyres.xyLineThicknesses      = [8,8]
    xyres.nglXYFillColors        = ["red","red"]
    xyres.nglXYBelowFillColors   = ["red","red"]
    xyres.nglXYAboveFillColors   = ["red","red"]

    xyline = Ngl.xy(wks,xvar,pter,xyres)

    Ngl.overlay(plot,xyline)

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20180831/fb94e870/attachment.html>


More information about the pyngl-talk mailing list