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:54, skrug wrote:

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, x= b[,1])

Also all columns have the same length, [R] states that the length are
different.

Can you help me?



baptiste auguie schrieb:
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 columns
against the first in 48 different graphs.
Can you help me?

Thank you in advance
Sebastian

--
***************************************************************************************************************


Dipl. Biol. Sebastian Krug
PhD - student
IFM - GEOMAR
Leibniz Institute of Marine Sciences
Research Division 2 - Marine Biogeochemistry
Düsternbrooker Weg 20
D - 24105 Kiel
Germany

Tel.: +49 431 600-4282
Fax.: +49 431 600-4446
email: sk...@ifm-geomar.de

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
______________________________



--
***************************************************************************************************************

Dipl. Biol. Sebastian Krug
PhD - student
IFM - GEOMAR
Leibniz Institute of Marine Sciences
Research Division 2 - Marine Biogeochemistry
Düsternbrooker Weg 20
D - 24105 Kiel
Germany

Tel.: +49 431 600-4282
Fax.: +49 431 600-4446
email: sk...@ifm-geomar.de


_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to