[R] Help with matplot
mentor_
mentor_ at gmx.net
Thu Nov 13 16:39:25 CET 2008
Hi,
two days ago I have asked the list if there is a better way to plot a matrix
using
the following plot command:
plot(matrix[1,], type="l")
for (i in 2:dim(matrix)[1]) {
lines(matrix[i,], type="l")
}
I have been told to use the matplot function, but unfortunately I matplot
does not plot my matrix
as I would like the matrix to be plotted...
Each row in the matrix should be plotted as a time series plot. The columns
should reflect the "time"
The matrix looks like this:
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 10.795525 17.742121 -1.668664 7.410594 10.229107 -0.7402613
[2,] 9.335885 10.472469 9.503561 9.815167 16.073518 21.1387238
[3,] 16.818605 5.354479 10.921837 5.202947 4.730314 2.3975041
[4,] 9.773960 10.081033 3.538419 16.913288 10.623028 7.8052165
[5,] 8.473132 13.775806 3.739209 15.224250 6.339220 7.3409747
I tried this with matplot:
m <- matrix(rnorm(30, 10, 5), ncol=6)
time <- matrix(rep(1:6,5), nrow=5, byrow=TRUE)
matplot(time, m, type="l", col="black")
Any help would be appreciate!
Thanks!
--
View this message in context: http://www.nabble.com/Help-with-matplot-tp20481662p20481662.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list