Re: background fill in XY plot

From: Saji N. Hameed (saji AT hawaii.edu)
Date: Wed Oct 19 2005 - 15:07:00 MDT

  • Next message: ssarkar: "Regridding question"

    Hi Hauss,

    I guess you could trick NCL into doing this with the aid of the
    resources related to gsnYRefLine. The following example illustrates
    one such trick.

    saji
    ------------------------
    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

    begin
             x=ispan(1,100,1)
             y=cos(x*3.14/50.)
                     res=True
                     res@gsnDraw=False
                     res@gsnFrame=False
                     ;;;;;;;;;;;;;;;;;
                     res2=res
                     res2@xyLineColor="yellow"
             ymin=min(y) ; calculate this or specify a value
             ymax=max(y) ; calculate this or specify a value
             y2=y/y ; create dummy variable y2
             y2=y2*ymax ; all values of y2=ymax
                     res@trYMinF=ymin
                     res@trYMaxF=ymax
                     ;;;;;;;;;;;;;;;;;
                     res@gsnYRefLine = ymin
                     res@gsnAboveYRefLineColor = "red"
             wks = gsn_open_wks("x11","test")
             plot1=gsn_csm_xy(wks,x,y2,res)
             plot2=gsn_csm_xy(wks,x,y,res2)
             overlay(plot1,plot2)
             draw(plot1)
             frame(wks)
    end

    Saji N. Hameed
    Assistant Researcher
    International Pacific Research Center,
    2525 Correa Road, Honolulu, HI 96822

    On Tue, 18 Oct 2005, Hauss Reinbold wrote:

    > Hi everyone. Are there any resources for filling the background of an XY
    > plot? Really all I want to do is add a nice grey background to some line
    > plots (leaving the area outside the plot area white). I can think of a
    > couple ways to do it with polygon fills, but I would rather use a resource if
    > there is one. I've checked the resources and searched the help files. What
    > did I miss? Or do I just have to create my own polygon fill underneath the
    > plot somehow? I have the feeling this should be obvious so forgive me if it
    > is. Thanks.
    >
    > Hauss Reinbold
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk@ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Wed Oct 19 2005 - 18:02:02 MDT