# Re: Plotting a constant line on a time series plot

```Hi Gary,
If a line spanning the entire width of the plot is acceptable
here is a solution that you might use

! example of overlaying a "y=constant" line on a plot of several
! time series of different lengths
def axis/t=5-mar-1980:14-apr-1980:1/units=days tax
def grid/t=tax grd
let v1=if(l ge 4 and l le 22)then l[g=grd]
let v2=if(l ge 7 and l le 25)then l[g=grd]-2
let v3=if(l ge 2 and l le 19)then l[g=grd]+1
! plot these three lines
plot/title="Time Series"/nolab v1,v2,v3

! now overlay a constant level line lev=10
let lev=10
let xlev=if(l eq 1)then `(\$XAXIS_MIN)` else `(\$XAXIS_MAX)`
let ylev=lev+l-l
plot/o/nolab/line=13/vs/l=1:2 xlev,ylev

If you wanted the constant level line to span say from 10% to 90%
of the time axis you could modify the above as follows

let xlev1=`(\$XAXIS_MIN)` + 0.1*(`(\$XAXIS_MAX)` - `(\$XAXIS_MIN)`)
let xlev2=`(\$XAXIS_MIN)` + 0.9*(`(\$XAXIS_MAX)` - `(\$XAXIS_MIN)`)
let xlev=if(l eq 1)then xlev1 else xlev2
let lev=12 ; plot/o/nolab/line=14/vs/l=1:2 xlev,ylev

Hope this helps,
Mick Spillane

|--****--****-*---*---***--***--|____spillane@pmel.noaa.gov____|
|-*__---*-----*--*-*--*--*-*--*-|_SCIENCE APPLICATIONS SUPPORT_|
|--***--*-----*-*---*-***--***--|____EPIC/Ferret/PlotPlus______|
|-----*-*-----*-*****-*----*----|__Room 2070 Bldg#3 NOAA/PMEL__|
|-****---****-*-*---*-*----*----|____Phone_:_(206)526-6780_____|

On Thu, 4 Jan 2001, Gary Strand wrote:

>
> I'd like to add a simple, constant value straight line to a plot of a time
> series of several quantities. For example, a time series of several model runs'
> average sea surface temperatures, and I want to include the mean Levitus
> value. The hitch is that not all the model run time series are of the same
> length, and, IIRC, it's not easy to specify the begin and end of a time axis.
>
> What I've done up until now is something like:
>
> plot/nolabel sst1,sst2,sst3,sst4,sst5
> let lev = if sst1 eq 1.e10 then 0 else 18.39
> plot/over/line=1 lev
>
> But that's not real clean if sst1 is much shorter in time than the other four
> runs.
>
> Any ideas?
>
> PS - It would be nice to have "user" coordinates to "/nouser" transforms, both
> directions, readily callable by FERRET, like GrADS does, so one can use geo-
> graphic coordinates and the "inches" coordinates on the plotting page
> more-or-less interchangably.
> --
> Gary Strand                Climate Change Research Section, NCAR (303) 497-1336
> strandwg@ucar.edu                          http://www.cgd.ucar.edu/ccr/strandwg
>

```