[R] Legend with fill = gray ?
Greg Snow
Greg.Snow at imail.org
Wed Sep 1 22:55:56 CEST 2010
Did you try gray.colors(3)?
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: Jens Oldeland [mailto:oldeland at gmx.de]
> Sent: Wednesday, September 01, 2010 2:43 PM
> To: Greg Snow
> Cc: r-help at r-project.org
> Subject: Re: [R] Legend with fill = gray ?
>
> Hi,
>
> sorry for beeing unprecise. I am looking for a legend that has the same
> colors as the barplot. For a coloured version I would simply use the
> same fill=rainbow() option as used in creating the barplot. However,
> this does not work when there are gray values, because there are not
> defined in the barplot command. So, finally, the legend for the gray
> scale figure needs a certain "fill=XXXX" command. 0.1:0.3 did not work,
> of course, I thought this would be quite obvious.
>
> Any idea how to get the legend in the right shape?
>
> Thanks!
>
> Greg Snow schrieb:
> > The phrase "does not work" can mean many things, it would help us to
> help you if you spelled out what you expected and how what you saw
> differs from what was expected.
> >
> > I suspect part of your problem may be in using 0.1:0.3, did you try
> typing just that at the command line to see the result? The ':'
> operator increments by 1 up until the largest values less than or equal
> to the right side, in this case it returns the single value 0.1.
> >
> > Barplot uses the gray.colors function when you don't specify the
> colors, perhaps using that will work for you. Or you could always pass
> specific shades of grey like you pass specific colors, then you don't
> need to guess or search.
> >
More information about the R-help
mailing list