Message-ID: <20050418165601.405164d9.Achim.Zeileis@wu-wien.ac.at>
Date: 2005-04-18T14:56:01Z
From: Achim Zeileis
Subject: Barplot and colors for legend
In-Reply-To: <4263C8CA.5070301@statistik.uni-dortmund.de>
On Mon, 18 Apr 2005 16:48:42 +0200 Uwe Ligges wrote:
> Werner Wernersen wrote:
>
> > Hi all!
> >
> > One quick question: How do I get the standard colors
> > used by barplot? I have
> > some stacked bars and would like to add a horizontal
> > legend via legend() but I
> > don't know how to find the colors for the fills of the
> > legend points.
> >
> > Thanks!
> > Werner
>
>
> Type
> barplot.default
> and read the code:
>
> for a vector: "grey",
> for a matrix: grey(seq(0.3^2.2, 0.9^2.2, length =
> nrow(height))^(1/2.2))
This must be an old version of R ;-)
In R 2.1.0, there is a function gray.colors() which creates a vector of
gamma-corrected gray colors (and is used in barplot.default).
Best,
Z
>
> Uwe Ligges
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>