Just so you know, in ggplot you already have scale_color_brewer which
provides color palettes from color brewer:
http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer.html
By going on the website, you can preview the palettes and in the
bottom left corner you have a rating of the palette for color-
blindness, photocopy, beamer projection etc. Many sequential and
diverging palettes are color-blind friendly already but, admittedly,
not many of the qualitative ones are.
JiHO
---
http://jo.irisson.free.fr/
and for the record: the dichromat package by Thomas Lumley has
color schemes " suitable for people with deficient or anomalous
red-green vision". It also has a function dichromat that takes
in regular R colors and shows the effect of color-blindness
(by collapsing red-green distinctions).
library(dichromat)
?dichromat
HTH,
Tobias
Another interesting feature to borrow from dichromat would be a
function, say test_colour() that you could add to a ggplot to check
the appearance for colour blind people, as in,
p <- qplot(...)
# testing
p + test_colour()
This one I'm not sure how to proceed though...
Perhaps a call to dichromat() within grid.edit with a search for
colour as a regular expression?
baptiste
I've started playing around with the palettes from dichromat,
http://ggplot2.wik.is/User:Bapt/Utilities/Dichromat_colour_palettes
So far I've rearranged the data to make it look more like brewer
palettes. Next step is to finish up and test the new scale.
Comments and ideas are welcome.
baptiste
--
_____________________________
Baptiste Auguié
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag
______________________________
library(dichromat)
library(ggplotpp)
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
str(dsamp)
d <- qplot(carat, price, data=dsamp, colour=cut)
d + scale_colour_dichromat(type="div")
d + scale_colour_dichromat(type="div", palette=2)
d + scale_colour_dichromat(type="div", palette=3)
d + scale_colour_dichromat(type="div", palette=4)
d + scale_colour_dichromat(type="div", palette=5)
d + scale_colour_dichromat(type="div", palette=6)
d + scale_colour_dichromat(type="div", palette=7)
d + scale_colour_dichromat(type="div", palette=8)
d + scale_colour_dichromat(type="seq")
d + scale_colour_dichromat(type="step")
d + scale_colour_dichromat(type="cat")
I'd be curious to hear ideas on how to implement the test_colour()
function described below.
baptiste
On Thu, May 21, 2009 at 4:08 PM, baptiste auguie