stephen sefick
2008-Mar-11 13:37 UTC
[R] Graphing question (multiple line graphs arranged spatially)
station month bas 190 5 0.000 190 7 1.563 190 10 0.000 190 11 0.000 202 4 18.750 202 5 18.750 202 7 6.250 202 10 4.800 202 11 3.125 198 4 18.750 198 5 31.250 198 7 3.125 198 10 3.200 198 11 12.500 205 4 0.000 205 5 0.000 205 7 0.000 205 10 0.000 205 11 0.000 c<-read.table("foo.txt", header=TRUE) x<-subset(c, station=="190") plot(x$bas~x$month, type="b") y<-subset(c, station=="198") plot(y$bas~y$month, type="b") z<-subset(c, station=="202") plot(z$bas~z$month, type="b") zz<-subset(c, station=="205") plot(zz$bas~zz$month, type="b") I would like to put all of the all of these individual line graphs into one 3d graph organized by descending station (205-190). Does anyone know how to do this? thanks Stephen -- Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
John Kane
2008-Mar-11 14:28 UTC
[R] Graphing question (multiple line graphs arranged spatially)
I don't quite see how you can do this as a 3-dimenional graph but will something like this do what you want? Note I used xx rather than c for the data.frame name. plot(x$bas~x$month, type="b", col=1, ylim=c(min(xx$bas),max(xx$bas)), xlim=c(max(xx$month),min(xx$month) )) lines(y$bas~y$month, type="b", col=2) lines(z$bas~z$month, type="b", col=3) lines(zz$bas~zz$month, type="b",col=4) --- stephen sefick <ssefick at gmail.com> wrote:> station month bas > 190 5 0.000 > 190 7 1.563 > 190 10 0.000 > 190 11 0.000 > 202 4 18.750 > 202 5 18.750 > 202 7 6.250 > 202 10 4.800 > 202 11 3.125 > 198 4 18.750 > 198 5 31.250 > 198 7 3.125 > 198 10 3.200 > 198 11 12.500 > 205 4 0.000 > 205 5 0.000 > 205 7 0.000 > 205 10 0.000 > 205 11 0.000 > > c<-read.table("foo.txt", header=TRUE) > x<-subset(c, station=="190") > plot(x$bas~x$month, type="b") > y<-subset(c, station=="198") > plot(y$bas~y$month, type="b") > z<-subset(c, station=="202") > plot(z$bas~z$month, type="b") > zz<-subset(c, station=="205") > plot(zz$bas~zz$month, type="b") > > I would like to put all of the all of these > individual line graphs > into one 3d graph organized by descending station > (205-190). Does > anyone know how to do this? > thanks > > Stephen > > > > > > -- > Let's not spend our time and resources thinking > about things that are > so little or so large that all they really do for us > is puff us up and > make us feel like gods. We are mammals, and have not > exhausted the > annoying little problems of being mammals. > > -K. Mullis > > ______________________________________________ > R-help at 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. >Looking for the perfect gift? Give the gift of Flickr!
David Winsemius
2008-Mar-11 14:40 UTC
[R] Graphing question (multiple line graphs arranged spatially)
"stephen sefick" <ssefick at gmail.com> wrote in news:c502a9e10803110637g4ebcf2f9mdfd0f5efda5d7299 at mail.gmail.com: fish <- "station month bas 190 5 0.000 190 7 1.563 190 10 0.000 190 11 0.000 202 4 18.750 202 5 18.750 202 7 6.250 202 10 4.800 202 11 3.125 198 4 18.750 198 5 31.250 198 7 3.125 198 10 3.200 198 11 12.500 205 4 0.000 205 5 0.000 205 7 0.000 205 10 0.000 205 11 0.000 " c<-read.table(textConnection(fish), header=TRUE)> > I would like to put all of the all of these individual line graphs > into one 3d graph organized by descending station (205-190). Does > anyone know how to do this?This seems to work: wireframe(bas ~ rev(station)*month, data=c) -- David Winsemius
David Winsemius
2008-Mar-11 14:47 UTC
[R] 2nd try; Re: Graphing question (multiple line graphs arranged spatially)
Subject: Re: Graphing question (multiple line graphs arranged spatially) Newsgroups: R-help:gmane.comp.lang.r.general To: stephen sefick <ssefick at gmail.com> "stephen sefick" <ssefick at gmail.com> wrote in news:c502a9e10803110637g4ebcf2f9mdfd0f5efda5d7299 at mail.gmail.com: fish <- "station month bas 190 5 0.000 190 7 1.563 190 10 0.000 190 11 0.000 202 4 18.750 202 5 18.750 202 7 6.250 202 10 4.800 202 11 3.125 198 4 18.750 198 5 31.250 198 7 3.125 198 10 3.200 198 11 12.500 205 4 0.000 205 5 0.000 205 7 0.000 205 10 0.000 205 11 0.000 " c.df <- read.table(textConnection(fish), header=TRUE)> > I would like to put all of the all of these individual line graphs > into one 3d graph organized by descending station (205-190). Does > anyone know how to do this?In my first reply I should have added the necessary lattice package that contains wireframe: library (lattice) wireframe(bas ~ rev(station)*month, data=c.df) -- David Winsemius
Jim Lemon
2008-Mar-12 11:08 UTC
[R] Graphing question (multiple line graphs arranged spatially)
stephen sefick wrote:> station month bas > 190 5 0.000 > 190 7 1.563 > 190 10 0.000 > 190 11 0.000 > 202 4 18.750 > 202 5 18.750 > 202 7 6.250 > 202 10 4.800 > 202 11 3.125 > 198 4 18.750 > 198 5 31.250 > 198 7 3.125 > 198 10 3.200 > 198 11 12.500 > 205 4 0.000 > 205 5 0.000 > 205 7 0.000 > 205 10 0.000 > 205 11 0.000 > > c<-read.table("foo.txt", header=TRUE) > x<-subset(c, station=="190") > plot(x$bas~x$month, type="b") > y<-subset(c, station=="198") > plot(y$bas~y$month, type="b") > z<-subset(c, station=="202") > plot(z$bas~z$month, type="b") > zz<-subset(c, station=="205") > plot(zz$bas~zz$month, type="b") > > I would like to put all of the all of these individual line graphs > into one 3d graph organized by descending station (205-190). Does > anyone know how to do this?Hi Stephen, One way may be with brkdn.plot (slightly modified and this isn't 3D): library(plotrix) # get the modification for one observation per point # this will be in the next version of brkdn.plot source("brkdn.plot.R") brkdn.plot("bas","station","month",ss.df,xaxlab=c(4,5,7,10,11), dispbar=FALSE,md=NA,pch=1:5,lty=1:5,xlab="Month") legend(8,25,unique(ss.df$station),pch=1:5,lty=1:5) Thanks for this - I hadn't thought about using this function with one datum per point. The modified function follows. Jim -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: brkdn.plot.R Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080312/26355870/attachment.pl