How to make ggplot2 graphics compatible with black

2019-05-07 08:45发布

Is there a way to convert ggplot2 plots into black-and-white versions without rewriting much of their code, so that the black-and-white versions remain readable?

For instance, to replace scale_fill_gradient with scale_fill_grey? Or automatically make photocopy-friendly transformations as sites like http://colorbrewer2.org/ advise. (Unfortunately, textures are not an option, as ggplot2 doesn't support them.)

It's clearly possible with if ... else and custom functions, but is there a more general solution?

1条回答
太酷不给撩
2楼-- · 2019-05-07 09:30

My second line in every ggplot figure I make is

theme_bw()

so

qplot(mpg, wt, data = mtcars) +
  theme_bw()
查看更多
登录 后发表回答