Dear List
I want to plot multiple time series (several outcomes) with dates at intervals
on the x axis and a legend.
Is it possible to use axis.Date to get dates, at intervals in my case, on the x
axis of a (multiple) time series plot.
The axis.Date in the code below doesn't produce any dates on the x axis.
(The difference outcome measures are all variable outcome in dataframe speclong
and the different groups correspond to different values of the variable time
with values 1 to 8)
But the same axis.Date command gives x axis Dates perfectly if following an
ordinary plot command. So I suppose I could do that and add time series for
successive time series using lines( but then I wouldn't have a legend or
I'd have to create one "manually"
Many thanks for any advice
Bernard
speclong
Date time outcome id
1.1 1998-01-29 1 8.11879e-13 1
2.1 1998-02-17 1 9.11297e-13 2
3.1 1998-03-20 1 4.95558e-13 3
4.1 1998-05-07 1 4.34171e-13 4
5.1 1998-05-26 1 2.41658e-13 5
6.1 1998-06-05 1 4.89529e-13 6
....
82.8 2005-07-15 8 2.37023e-11 82
83.8 2005-08-23 8 3.52766e-11 83
84.8 2005-09-08 8 1.98099e-11 84
85.8 2005-10-18 8 2.93576e-11 85
86.8 2005-11-18 8 6.30531e-11 86
87.8 2005-12-01 8 5.71245e-11 87>
interaction.plot(speclong$Date,speclong$time,speclong$outcome,log="y",xaxt="n",col=rainbow(8)
)
> axis.Date(1,at=(as.Date("1998-01-01")
+c(0:7)*365.25),format="%d/%m/%y", las=2)
>
> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32
locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
[[alternative HTML version deleted]]