使用ggplot2建议黑白配色方案 [英] Recommendations for black and white color scheme with ggplot2

查看:777
本文介绍了使用ggplot2建议黑白配色方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ggplot2生成了许多类似这样的图:


有没有一种容易制作黑白相间的东西?我确实阅读过这个问题,但它仍在制作一个彩色填充。

解决方案

我不确定颜色是否真的有助于此图,因为已经清楚每个boxplot对应的内容至。但是,如果您仍然需要以黑白方式着色,可以使用 scale_fill_grey 来实现。这里是一个例子

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

这会产生如下所示的输出:


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.

解决方案

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

这篇关于使用ggplot2建议黑白配色方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆