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: skrug at ifm-geomar.de
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: skrug at ifm-geomar.de > > ______________________________________________ > R-help at r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide 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 newton.ex.ac.uk/research/emag
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: skrug at ifm-geomar.de >> >> ______________________________________________ >> R-help at r-project.org mailing list >> stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> 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 > > 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: skrug at ifm-geomar.de
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('topleft',c('x1','x2'),pch=16,col=1:2) See ?matplot, ?axis and ?legend for more information. HTH, Jorge On Fri, Mar 27, 2009 at 7:05 AM, skrug <skrug@ifm-geomar.de> 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: skrug@ifm-geomar.de > > ______________________________________________ > R-help@r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]