Skip to content

Graphing question (multiple line graphs arranged spatially)

5 messages · stephen sefick, John Kane, David Winsemius +1 more

#
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
#
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:

            
Looking for the perfect gift? Give the gift of Flickr!
#
"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)
This seems to work:

wireframe(bas ~ rev(station)*month, data=c)
#
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)
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)
#
stephen sefick wrote:
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