Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommendations for black and white color scheme with ggplot2

Tags:

I'm using ggplot2 to produce many diagrams structured like this:

enter image description here

Is there an easy of producing something that looks good in black and white? I did read this question but it still is producing a colored fill.

like image 700
djq Avatar asked May 12 '11 16:05

djq


People also ask

What color scheme uses black and white?

Black and white is the best example of a monochromatic colour scheme.

Is Ggplot colorblind friendly?

The default colors in ggplot2 can be difficult to distinguish from one another because they have equal luminance. They are also not friendly for colorblind viewers.

Which color scheme uses combinations of black white and gray?

Monochromatic colors are all the colors (tints, tones, and shades) of a single hue. Monochromatic color schemes are derived from a single base hue, and extended using its shades, tones and tints (that is, a hue modified by the addition of black, gray (black + white) and white.

What colors does Ggplot recognize?

By default, ggplot graphs use a black color for lines and points and a gray color for shapes like the rectangles in bar graphs.


2 Answers

I am not sure if color really helps in this graph, since it is already clear what each boxplot corresponds to. However, if you still need to color this in black and white, you can achieve it using scale_fill_grey. Here is an example

library(ggplot2) data(tips) p0 = qplot(day, tip/total_bill, data = tips, geom = 'boxplot', fill = day) +    scale_fill_grey() print(p0) 

This produces the output shown below enter image description here

like image 171
Ramnath Avatar answered Sep 28 '22 01:09

Ramnath


The default fill colour for ggplot is black and white:

ggplot(diamonds, aes(x=cut, y=price, group=cut)) + geom_boxplot() 

enter image description here

If you prefer not to have the greyscale panel, you can use the black and white theme:

ggplot(diamonds, aes(x=cut, y=price, group=cut)) + geom_boxplot() + theme_bw() 

enter image description here

To get a colour or greyscale fill as a scale you have to add fill as a parameter to aes (as illustrated by @ramnath).

like image 35
Andrie Avatar answered Sep 28 '22 00:09

Andrie