Re: [R] color scale mapped to B/W

From: Achim Zeileis <Achim.Zeileis_at_wu-wien.ac.at>
Date: Sat, 07 Jun 2008 10:21:58 +0200 (CEST)

On Fri, 6 Jun 2008, hadley wickham wrote:

> On Fri, Jun 6, 2008 at 6:23 PM, Achim Zeileis
> <Achim.Zeileis_at_wu-wien.ac.at> wrote:
>> On Fri, 6 Jun 2008, Michael Friendly wrote:
>>

>>> In an R graphic, I'm using
>>>
>>> cond.col <- c("green", "yellow", "red")
>>> to represent a quantitative variable, where green means 'OK', yellow
>>> represents 'warning'
>>> and red represents 'danger'. Using these particular color names, in B/W,
>>> red is darkest
>>> and yellow is lightest. I'd like to find color designations to replace
>>> yellow and green so
>>> that when printed in B/W, the yellowish color appears darker than the
>>> greenish one.

>>>
>>> Is there some tool/code I can use to find these? i.e., something to
>>> display a grid
>>> of color swatches with color codes/names I can look at in color and B/W to
>>> decide?
>>
>> You could look at colors in HCL (i.e., polar LUV). For example, you could
>> choose a dark red HCL = (0, 90, 40) and a light green (120, 70, 90) and a
>> yellow somewhere in between.
>
> How did you get to those numbers?

>From scratch:

• hues 0 and 120 because Michael wanted red and green
• luminances 40 and 90 for sequential colors from dark to light
• chromas 90 and 70 for two reasons: only small differences in chroma seemed necessary, and 90 and 70 are close to the maximal values given the other two coordinates for each color.

> I seem to remember there being
> someway to convert rgb to hcl, but I can't find it.

I always use "colorspace" for that. See

example("polarLUV", package = "colorspace")

Best,
Z

>
>
> --
>
>

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 07 Jun 2008 - 08:24:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 07 Jun 2008 - 08:30:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.