[R] B-W stacked area chart with pattern

Greg Snow Greg.Snow at imail.org
Wed Jan 30 22:39:23 CET 2008


I think I would use lines for this, notice in your barplots how the higher species seem to bounce around more than the ones at the bottom of the plot even though they come from the same random process, this is because you are adding the effects of the randomness as you go up and this makes it harder to understand.  Try either of the following to see if they help:

> matplot(seq(0,200,5), t(res), type='l')
> library(lattice)
> tmp <- data.frame( time = rep( seq(0,200,5), 12 ), species = rep(1:12, each=41),
+ res=c(t(res)) )
> xyplot( res~time|factor(species), data=tmp, type='l' )

These can be augmented once you decide which route to take.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: Markus Didion [mailto:markus.didion at env.ethz.ch] 
> Sent: Wednesday, January 30, 2008 1:16 AM
> To: Greg Snow
> Cc: r-help at r-project.org
> Subject: Re: [R] B-W stacked area chart with pattern
> 
> Thank you Greg for your comments.
> Here is a (very) simple example of what my data might look like:
> 
> res <- matrix(sample(20:25, 41*12, replace=T), nrow=12, 
> ncol=41, dimnames=list(c(paste("sp",1:12)), c(seq(0, 200, 
> by=5)))) barplot(res, space=0, legend.text=T, beside=F, 
> col=c("white","grey50"),
> border=NA)
> barplot(res, space=0, beside=F, angle=seq(0, 180, by=45), 
> density=30, col="black", border=NA, xlab="time", 
> ylab="biomass (t/ha)", add=T)
> 
> I have 3 replicates of the data for 2 sites that all have 
> small but important differences. I would like to show them on 
> a panel with 3 columns and 2 rows.  This is why I thought 
> using stacked area charts as they would let you easily 
> compare between the 3 replicates.
> 
> thank you very much for your help
> Markus
> 
> 
> Greg Snow wrote:
> > I would question if a stacked area chart is really the best 
> way to display information on 12 groups.  You can put a lot 
> of information into the plot, but the viewer will probably 
> experience information overload and not be able to get much 
> useful information out of the plot.  Stacked area plots rely 
> on people being able to compare areas and lengths, which we 
> don't do as well as we compare positions in a graph.  If your 
> viewer is needing to go back and forth between the legend and 
> the graph, then the information will be harder to assimilate. 
>  It may be better to use lattice/trellis graphs and plot each 
> line in its own panel (on the same scale and possibly with a 
> light background grid to make comparison easier).  If there 
> are specific comparisons that you want to point out, then 
> make a separate graph with just those comparisons leaving out 
> the extra information that will just distract.
> > 
> > If you give us a better idea of what information you are 
> trying to convey, we may be able to give you some better 
> options for graphs to use.
> > 
> > If you really want to go the pattern route then you may 
> want to look at the discussion from october that started 
> with: 
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/111226.html 
> and/or the discussion from earlier this week started by 
> yaosheng CHEN with the subject "How to fill bar plot with 
> textile rather than color".
> > 
> > Hope this helps,
> > 
> -- 
> 
> Markus Didion
> 
> Waldökologie				Forest Ecology
> Inst. f. Terrestrische Oekosysteme	Inst. of Terrestrial Ecosystems
> Departement Umweltwissenschaften	Dept. of Environmental Sciences
> Eidg. Technische Hochschule		Swiss Fed. Inst. of Technology
> ETH-Zentrum CHN G78			ETH-Zentrum CHN G78
> Universitätstr. 22			Universitaetstr. 22
> CH-8092 Zürich				CH-8092 Zurich
> Schweiz					Switzerland
> 
> Tel +41 (0)44 632 5629		Fax +41 (0)44 632 1358	
> Email markus.didion at env.ethz.ch
> homepage: http://www.fe.ethz.ch/people/didionm
> 	
> 
> 
> 



More information about the R-help mailing list