It's not too hard to use rect() to add shading to the boxplots. The boxes
are centered on consecutive integers and the width is +/- .4. The boxplot()
function returns the quartiles of each box.
set.seed(42)
DF<- data.frame(val=rnorm(150), grp=rep(letters[1:6], 25))
outstat<- boxplot(val~grp, DF) # save the boxplot stats
ngroups<- length(levels(DF$grp)) # get number of groups
dval<- c(6, 6, 6, 12, 12, 12) # density vals for each group
aval<- c(0, 30, 60, 90, 120, 150) # angle vals for each group
rect((1:ngroups)-.4, outstat$stats[2,], (1:ngroups)+.4, outstat$stats[4,],
density=dval, angle=aval) # draw the rectangles
You can also play with lty= and lwd= but that will affect the box border as
well.
----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
project.org] On Behalf Of Susanne Meyfarth
Sent: Thursday, August 09, 2012 12:08 PM
To: John Kane
Cc: r-help at r-project.org
Subject: Re: [R] Fill pattern for Boxplots?
Thank you. I saw these postings, but I don't want to learn lattice for
this reason (was afraid to have to change then everything else in my
graph). Anyway, I now tried with different shades of greyscale (4
shades). I'm not fully satisfied with it, but it's ok. It's for a
publication and depending on whether I have to change the graph, I
decide to either put texture in some boxes manually or still look for a
solution in R.
--------Original Message----------
From: John Kane<jrkrideau at inbox.com>
To: suse<meyfarth at uni-potsdam.de>, r-help at r-project.org
Date: 09.08.2012 16:52
Subject: Re: [R] Fill pattern for Boxplots?
td4457209.html on this topic.
What exactly are you doing? There may be a workaround or
John Kane
Kingston ON Canada