[R] Problems plotting time-series with multiple lines

Felipe Csaszar fcsaszar at gmail.com
Sat Sep 3 11:32:07 CEST 2005


He you checked this example?:
z <- ts(matrix(rt(200 * 8, df = 3), 200, 8), start = c(1961,1), frequency = 
12)
z <- window(z[, 1:3], end = c(1969, 12))
plot(z, plot.type = "single", lty = 1:3, col = 4:2)

It is from the help page of plot.ts

Felipe


"Jose Augusto Jr - jamaj - terra" <jamaj at terra.com.br> wrote in message 
news:001b01c5b032$933e8a90$6300a8c0 at 3k54gri437t...
Dear Sirs,

I want to plot a time series with lines, one for each variable.
I have a dataset with dates, and the values.
How can i plot?
I could plot one variable using index plot, bu i want to put the labels on X
axis. But i had two problems:
1) The plot function, when i try to plot(x,y), incorectly sort the date (on
X axis). My dataset has the date in string format "%d/%m/%Y).
If i try to converto to date using
as.Date(Dataset.dates,"%d/%m/%Y)
it interprets the %Y incorrectly.

2) I have 187 rows. So i have to plot only some of the dates, not all.

Please, help me.

Thanks in advance.

Best Regards,

José Augusto M. de Andrade Jr.

"Computer games don't affect kids; I mean if Pac-Man affected us as kids,
we'd all be running around darkened rooms, munching magic pills and
listening to
repetitive electronic music." (Kristian Wilson, Nintendo, Inc. 1989)

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list