[Thread Prev][Thread Next][Index]
Re: Ferret question
Hi Marcelo and all,
a while ago I wanted to shade the area between two lines, just as
Marcelo, and got two suggestions from Steve and Weimin.
Here is in essence what I ended up doing (below is the full script,
which uses to identical viewports to plot lines over the shaded
area as well as the axes, which are not plotted with the shading):
! the time axis of the data
define axis/t="15-AUG-1998 00:07:30":"31-DEC-1999
23:52:30":0.010416667/unit="days since 01-Jan-1998 00:00:00" timtax
define grid/t=timtax timtgrd
define axis/T="1-JUL-1998 12:00:00":"31-JUL-2000 12:00:00":1/unit=day
tdayax
define axis/y=0:0.6:0.005 yax
define grid/y=yax/t=tdayax tdaygrd
set data/ez/var=w1,w2,w3,w4/grid=timtgrd wrccrf_swc_199899_tim_d.dat
! calculate variables to be used for determining the shaded area
let wta=(w1+w2+w3+w4)/4.
let wtv=(w1^2+w2^2+w3^2+w4^2)/4.-wta^2
let wts=wtv^0.5
! plus/minus one std.dev.
let wtad=wta[gt=tdayax]
let wtsd=wts[gt=tdayax]
! define shaded area
let shade_area= if y[g=tdaygrd] le wtad+wtsd AND y[g=tdaygrd] ge
wtad-wtsd then 1+t[g=tdaygrd]*0
shade/lev=(-4,5,1)/nolabel/nokey/set shade_area[t="1-JUL-1998
12:00:00":"30-JUN-1999 12:00:00"]
! no axes, labels...
ppl axset 0,0,0,0
ppl ylab
ppl shade
'hope it works for you as well.
Cheers,
Joerg
>
> Hi Joerg,
>
> I am trying to shade the area between two lines, and do not have a clue
> how to do this. I read your message asking the same question a few months
> ago. Did you figure out how to do this?
> Any help would be greatly appreciated!
>
> Marcelo
Full script:
! go fig_soil_wat.jnl
!** soil water, Figure 4
!* 1998-1999
cancel view
cancel mode ascii
set mem/size=100
!** 13 Tim's soil water data
! define time axis
define axis/t="15-AUG-1998 00:07:30":"31-DEC-1999
23:52:30":0.010416667/unit="days since 01-Jan-1998 00:00:00" timtax
define grid/t=timtax timtgrd
define axis/T="1-JUL-1998 12:00:00":"31-JUL-2000 12:00:00":1/unit=day
tdayax
define axis/x=1:1:1 xax
define axis/y=0:0.6:0.005 yax
define grid/y=yax/t=timtax timtygrd
define grid/y=yax/t=tdayax tdaygrd
!* define two identical viewports
! for shaded area
def view/xlim=0,1/ylim=0.1:1 my_view_1
! for plotting lines over the shaded area
def view/xlim=0,1/ylim=0.1:1 my_view_2
set mode meta
go bold
ppl dfltfnt TR
ppl pen,0,7
!* plot shaded area with no labels!
set view my_view_1
! get data
set data/ez/var=w1,w2,w3,w4/grid=timtgrd wrccrf_swc_199899_tim_d.dat
! calculate variables to be used for determining the shaded area
let wta=(w1+w2+w3+w4)/4.
let wtv=(w1^2+w2^2+w3^2+w4^2)/4.-wta^2
let wts=wtv^0.5
let wtad=wta[gt=tdayax]
let wtsd=wts[gt=tdayax]
! define shaded area
let shade_area= if y[g=tdaygrd] le wtad+wtsd AND y[g=tdaygrd] ge
wtad-wtsd then 1+t[g=tdaygrd]*0
shade/lev=(-4,5,1)/nolabel/nokey/set shade_area[t="1-JUL-1998
12:00:00":"30-JUN-1999 12:00:00"]
! no axes, labels...
ppl axset 0,0,0,0
ppl ylab
ppl shade
! * plot lines over shaded area
set view my_view_2
let xw=0.5/6.
plot/set_up/nolabel/xlimits=181:545:30/ylimits=0:0.60:0.05/line=14
www[i=3,j=1,d=6]*xw, www[i=3,j=1,d=12,l=2:8688]*xw
! plot axes labels...
ppl labset 0.25,0.2,0.2,0.2
ppl axset 1,1,1,1
ppl title Volumetric soil moisture
ppl txlsze 0.18
ppl yfor "(f3.1)"
ppl ylab Fraction
ppl plot
plot/over/nolabel/line=7 wc[d=2,t=181:260]
plot/over/nolabel/line=15 www[i=3,j=2,d=6]*xw,
www[i=3,j=2,d=12,l=2:8688]*xw
plot/over/nolabel/line=16 www[i=3,j=3,d=6]*xw,
www[i=3,j=3,d=12,l=2:8688]*xw
label/nouser -0.95,-2.1,-1,0,0.25 Figure 4
canc mode meta
message
!spa Fprint -l cps -o xx_soil_water_98_99.ps metafile.plt
!spa lpr -PAUTO xx_soil_water_98_99.ps
spa Fprint -l ps -o xx_soil_water_98_99_bw.ps metafile.plt
!spa lpr xx_soil_water_98_99_bw.ps
CANCEL VIEWPORT
go unbold
ppl/reset
! close Tim's soil water data
cancel data 13
spa rm metafile*
quit
> P.S. Actually, I am trying to do exactly the same thing as you: represent
> +-1 one standard deviation around something along my time axis and then
> overlay other data to compare.
>
> ================================================
> Marcelo Barreiro
> Dept. of Oceanography, Physical Section
> College of Geosciences and Maritime Studies
> Texas A&M University
> College Station, TX 77843-3146
> Phone: (979) 845-8216
> URL: http://www-ocean.tamu.edu/~marcelo/
> ================================================
--
Jörg Kaduk Tel.: 1 650 325 1521 x 416
Carnegie Institution of Washington FAX: 1 650 325 6857
Dept. of Plant Biology
260 Panama Street joerg@jasper.stanford.edu
Stanford, CA 94305-1297 http://Jasper.Stanford.EDU/joerg/
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement