Reputation: 15298
I'm using ggplot2 to produce many diagrams structured like this:
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.
Upvotes: 24
Views: 56062
Reputation: 179518
The default fill
colour for ggplot is black and white:
ggplot(diamonds, aes(x=cut, y=price, group=cut)) + geom_boxplot()
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()
To get a colour or greyscale fill
as a scale you have to add fill as a parameter to aes
(as illustrated by @ramnath).
Upvotes: 9
Reputation: 55725
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
Upvotes: 36