US Fish Wildlife Service
California, USA
--- On Fri, 8/7/09, Clint Bowman cl...@ecy.wa.gov wrote:
From: Clint Bowman cl...@ecy.wa.gov
Subject: Re: [R] How do I plot a line followed by two forecast points?
To: Jorgy Porgee jorgy.por...@gmail.com
Cc: Jean V Adams jvad...@usgs.gov, r-help@r
. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish Wildlife Service
California, USA
--- On Fri, 8/7/09, Clint Bowman cl...@ecy.wa.gov wrote:
From: Clint Bowman cl...@ecy.wa.gov
Subject: Re: [R] How do I plot a line followed by two forecast points?
To: Jorgy Porgee
Good day all,
I'm trying to plot a continuous line plot, which is followed by two
forecast points eg. one forecast point is 12 months out, and another
24 months out from the last date of the line plot.
In my attempts so far, the second plot (the forecast points) is scaled
against a new axis
Hi Jean,
Thank you for the reply. I do have the forecast points before I plot,
the example below was just for illustration purposes..If I am to add
the forecast points to one y-series data plot however, is there a way
of highlighting them? This is essentially what I'm trying to do below
by
Because you know a priori the dates associated with your forecast points
you could use the col= in the plot function to change colors for the last
two points (may require some mathmatical gymnastics to specify the colors
desired--I've set up a vector and created an index from either the x or y
Just wait until after you have the forecasts before you create the plot.
# Sample dates
xValues - seq.Date(as.Date(1990-01-31), to=as.Date(1992-12-31),
by=month)
# Sample y value
yValues - seq(0.1, length=length(xValues))
# Sample forecast one year from xValue's end point
fcastDate -
Run this codes:
plot( 1:20, type='l')
lines( 0.5*1:20, col=2)
If you use par(new=T), this will call a new high-level graphic device,
which is why the axes do not match. Alternatively, you can set ylim
and pass the arguments to two plot functions:
plot( rnorm(100), type='h', ylim=c(-3,3))
7 matches
Mail list logo