[R] plotting several columns of matrix in one graph
arun
smartpink111 at yahoo.com
Thu Apr 3 00:41:01 CEST 2014
Hi,
May be this helps:
library(xts)
library(xtsExtra)
data(sample_matrix)
plot(as.xts(sample_matrix),screens=1)
#or
library(zoo)
plot(as.zoo(sample_matrix), plot.type="single",col=1:ncol(sample_matrix))
You may also check ?matplot
A.K.
Hi everyone, I have started using R and although I am used to some other languages, I am struggling doing a plot that contains several lines which each correspond to a column of the Matrix which all my data. I tried to google it but unfortunately, it haven't found anything which helped me and also the description didn't really give me a hint what to do. Let's say I have Matrix calles Data_Set which consists of 6 columns and let's say 100 rows. in the first column, I have the date, which is also the x-axis of my plot. The next five column contain the time series, for each of them I want I line drawn in the plot. I have installed the lattice package and I tried several things using the xyplot command, but it didn't work. thanks so much for your help.
More information about the R-help
mailing list