[R] barplot default colors
Thomas Lumley
tlumley at u.washington.edu
Wed Feb 5 17:51:03 CET 2003
On Wed, 5 Feb 2003, Liaw, Andy wrote:
> Can some one explain why barplot() uses changing colors in the bars by
> default? I should think that most of the time when people draw barplots,
> they want the bars to be in the same color. (At least that's what I'd
> expect. The first time I used barplot() in R, I was shocked to see the
> colors.) As an example, one example in ?layout draws a scatterplot with
> histograms drawn on the margins. The histograms were drawn by barplot(),
> and, IMHO, look rather hideous in the colors.
The changing colours are useful when the data are a matrix (so that you
have bars either stacked or in groups). You can easily get a single
color,
eg
data(VADeaths)
barplot(VADeaths, beside=TRUE, col="thistle")
The colours themselves are definitely not ideal. As Paul Murrell said at
the beginning of his talk on colour at last year' JSM "The only word for
this is `embarassing'". Better colour palettes are in the works, eg see
the RColorBrewer package.
-thomas
More information about the R-help
mailing list