Thanks for the help, Michael. ggplot2 is an interesting package. It would
nice if there were better documentation in the help files, but the (fully
functional) code (with fake data) I've settled on is below. I am
particularly pleased with the theme_bw, which will use less ink than the
default theme, the alignment of the x-grid labels using hjust = 1, and the
y-axis label, which finally has the superscript it requires!

Per your suggestion, I wrote this code while listening to a variety of
classic rock ballads - it was extremely helpful.

- Gabe

site.txt = c("Brownsville","Chip Ross","Finley","Jim's
Creek","Lowell","Mount Pisgah","South Eugene")
leg.txt = c("Abies grandis","Acer macrophyllum","Calocedrus
decurrens","Pinus ponderosa","Pseudotsuga meziensii","Quercus
garryana","Quercus kelloggii")
#
# Fake Data
site = rep(site.txt, each = 21)
sp = rep(rep(leg.txt, each = 3), times = 7)
ga = runif(147, 0, 20)
datnew.lo = data.frame(site,sp,ga)
#
# Make the plot
library(ggplot2)
theme_set(theme_bw())
ggplot(datnew.lo, aes(x = sp, y = ga)) + geom_boxplot() +
facet_wrap(~site, ncol = 7) +
opts(axis.text.x=theme_text(angle=90, size = 8, hjust = 1)) +
xlab("Species") +
ylab(expression(paste('Basal Area Growth Increment (mm  '^{2},')')))

On Thu, Mar 8, 2012 at 12:22 PM, R. Michael Weylandt <
michael.weylandt@gmail.com> wrote:

> On Thu, Mar 8, 2012 at 1:08 PM, Gabriel Yospin <yosping@gmail.com> wrote:
> > Hello R Help!
>
> Hello Gabe Yospin! (I feel like I should start playing some arena rock
> anthem now ;-) )
>
> >
> > I would like to make a legible boxplot of tree growth rates for each of
> > seven tree species at each of seven different sites. It's a lot of data
> to
> > put on one figure, I know. I made a beautiful, interpretable figure using
> > color, but my target journal can't deal with color figures. I can use
> seven
> > shades of grey to fill the boxes, but the figure then becomes
> > uninterpretable - the colors of adjacent boxes are too similar. I cannot
> > figure out how to add a pattern, hatching, or cross-hatching to the
> boxes.
> >
> > I see that in 2003 Professor Ripley confirmed that one cannot hatch
> > boxplots:
> >
> > http://tolstoy.newcastle.edu.au/R/help/03a/2622.html
> >
> > Is this still true? If so, does anyone have a suggestion for how to make
> > this figure interpretable in black and white? Should I pick a different
> > target journal?
> >
>
> I don't think you'd need to change journals just for graphical styles:
> do it for much less important things, like impact factor. It sounds
> like the idea of small multiples might help here: I'm not a lattice
> pro, but here's something you could do in ggplot2 (and I know it's
> doable in lattice as well):
>
> I'm gonna put new lines in all your species names since space will be
> at a premium:
>
> levels(datnew.lo$sp) <- gsub(" ", "\n", levels(datnew.lo$sp))
>
> library(ggplot2)
> ggplot(datnew.lo, aes(x = sp, y = ga)) + geom_boxplot() +
> facet_wrap(~site, nrow = 2) + opts(axis.text.x=theme_text(angle=45,
> size = 7))
>
> Others with more ggplot / lattice - fu than I can help you tweak this
> but hopefully this is a start.
>
> Michael
>
>
> > Many thanks,
> >
> > Gabe
> >
> > Functional code to make the color figure with fake data follows:
> > #
> > leg.txt = c("Abies grandis","Acer macrophyllum","Calocedrus
> > decurrens","Pinus ponderosa","Pseudotsuga meziensii","Quercus
> > garryana","Quercus kelloggii")
> > site.txt = c("Brownsville","Chip Ross","Finley","Jim's
> > Creek","Lowell","Mount Pisgah","South Eugene")
> > colors = c("gray","red","white","blue","yellow","purple","orange")
> > # Fake data here:
> > site = rep(site.txt, each = 21)
> > sp = rep(rep(leg.txt, each = 3), times = 7)
> > ga = runif(147, 0, 20)
> > datnew.lo = data.frame(site,sp,ga)
> > # Now make the plot:
> > boxplot(ga~sp*site,data=datnew.lo, range = 1,
> >        col = colors,
> >        ylim = c(0,30),
> >        xaxt = "n",
> >        xlab = "Site",
> >        ylab = "Basal Area Growth Increment",
> >        main = "Basal Area Growth Increment by Site and Species")
> > axis(1, at = c(4,11,18,25,32,39,46),
> >     labels = site.txt,
> >     )
> > abline(v = 7.5, lty = 3)
> > abline(v = 14.5, lty = 3)
> > abline(v = 21.5, lty = 3)
> > abline(v = 28.5, lty = 3)
> > abline(v = 35.5, lty = 3)
> > abline(v = 42.5, lty = 3)
> > legend("topright", legend = leg.txt, fill = colors, bg = "white")
>
> Thanks for the great reproducible example! Made this much easier and more
> fun.
>
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
>

	[[alternative HTML version deleted]]

