Re: [R] Ploting a matrix

2009-03-27 Thread Jorge Ivan Velez
Dear Sebastian, Consider matplot() for this. Here is an example (taken from Baptiste Auguie's post): date <- factor(letters[1:9]) d <- data.frame(x1=seq(1, 9), x2=seq(2, 10), date=date) matplot(d[,-3],pch=16,xaxt='n',las=1,ylab='Some label here',xlab='Date') axis(1,d[,3],d[,3]) legend('toplef

Re: [R] Ploting a matrix

2009-03-27 Thread baptiste auguie
Here's my suggestion using the ggplot2 package (but you may prefer to stick with base functions), date = factor(letters[1:9]) d <- data.frame(x1=seq(1, 9), x2=seq(2, 10), date=date) head(d) # dummy data that resembles yours str(d) library(reshape) md <- melt(d, id="date") # creates a data.fr

Re: [R] Ploting a matrix

2009-03-27 Thread skrug
Sorry for the mistake. As you probably already guesed, I am just starting using R. I could not name the difference between a matrix and a data.frame. > str(b) 'data.frame': 9 obs. of 7 variables: $ Datum: Factor w/ 9 levels "06.03.","07.03.",..: 1 2 3 4 5 6 7 8 9 $ X1 : int 408 335 2123 4

Re: [R] Ploting a matrix

2009-03-27 Thread baptiste auguie
the result of read.table is a data.frame, not a matrix as you first suggested. Can you copy the result of str(b) so we know what your data is made of? I'm guessing the most elegant solution will be to use the reshape package, followed by ggplot2 or lattice. baptiste On 27 Mar 2009, at 14

[R] Ploting a matrix

2009-03-27 Thread skrug
Unfortunately, I could not solve the problem of plotting all columns of a matrix against the first column I used: b=read.table("d:\\programme\\R\\übungen\\Block 1b.txt", header=T) "b" is a table with the first column using Dates and the following columns with vectors. apply(b[,-1], 2, plot

Re: [R] Ploting a matrix

2009-03-27 Thread baptiste auguie
Something like this perhaps, a <- matrix(rnorm(5*49), ncol=49) pdf(width=15, height=15) par(mfrow= c(8,6)) apply(a[,-1], 2, plot, x= a[,1]) dev.off() HTH, baptiste On 27 Mar 2009, at 11:05, skrug wrote: Hi evrybody, in a matrix consisting of 49 columns, I would like to plot all column

[R] Ploting a matrix

2009-03-27 Thread skrug
Hi evrybody, in a matrix consisting of 49 columns, I would like to plot all columns against the first in 48 different graphs. Can you help me? Thank you in advance Sebastian -- *** Dip