s-news
[Top] [All Lists]

Re: Tufte and boxplots?

To: "Thomas D. Fletcher" <tom.fletcher@cox.net>, S-News List <s-news@lists.biostat.wustl.edu>
Subject: Re: Tufte and boxplots?
From: "Richard M. Heiberger" <rmh@temple.edu>
Date: Mon, 28 Feb 2005 20:24:05 -0500
## The easiest way to do a Tufte-style bwplot is to use the bwplot
## function and change the colors.

tmp <- data.frame(y=rnorm(20),
                  a=rep(1:2, c(8,12)))
bwplot(a ~ y, data=tmp, main="standard colors")

## now change the colors
b.r <- trellis.par.get("box.rectangle")
b.u <- trellis.par.get("box.umbrella")

## It is easy to turn off the rectangle
b.r$col <- 0
trellis.par.set("box.rectangle", b.r)
bwplot(a ~ y, data=tmp, main="blank rectangle")


## The staple ends, body, and dotted.line are all controlled by the
## same box.umbrella parameter.  To get finer control you will have to
## revise the panel.bwplot (call your revision something else, say
## panel.bwplot.fletcher) to separate those items and invent some new
## parameters for their colors.  The colors should default to the
## box.umbrella colors.


## Having said the above, I don't like the appearance.  I agree you
## use less ink, but I think you also lose some information.  I think
## it would be better to use narrow boxes by using a smaller value of
## box.ratio.

## restore color to box.rectangle
b.r$col <- 2
trellis.par.set("box.rectangle", b.r)
bwplot(a ~ y, data=tmp, main="narrow boxes", box.ratio=.3)

<Prev in Thread] Current Thread [Next in Thread>