Graphics Reference
In-Depth Information
c( "#000000" , "#E69F00" , "#56B4E9" , "#009E73" , "#F0E442" , "#0072B2" , "#D55E00" ,
"#CC79A7" )
Discussion
About 8 percent of males and 0.5 percent of females have some form of color-vision deficiency,
so there's a good chance that someone in your audience will be among them.
There are many different forms of color blindness. The palette here is designed to enable people
with any of the most common forms of color-vision deficiency to distinguish the colors. (Mono-
chromacy, or total colorblindness, is rare. Those who have it can only see differences in bright-
ness.)
See Also
The source of this palette .
The Color Oracle program can simulate how things on your screen appear to someone with
color vision deficiency, but keep in mind that the simulation isn't perfect. In my informal testing,
I viewed an image with simulated red-green deficiency, and I could distinguish the colors just
fineā€”but others with actual red-green deficiency viewed the same image and couldn't tell the
colors apart!
Using a Manually Defined Palette for a Continuous
Variable
Problem
You want to use different colors for a continuous variable.
Solution
In the example here, we'll specify the colors for a continuous variable using various gradient
scales ( Figure 12-12 ). The colors can be named, or they can be specified with RGB values:
library(gcookbook) # For the data set
# Base plot
p <- ggplot(heightweight, aes(x = ageYear, y = heightIn, colour = weightLb)) +
geom_point(size = 3 )
p
Search WWH ::




Custom Search