ggplot2:如何在主题中设置geom_bar()的默认填充颜色 [英] ggplot2: How do I set the default fill-colour of geom_bar() in a theme

查看:1309
本文介绍了ggplot2:如何在主题中设置geom_bar()的默认填充颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为ggplot2定义一个主题,以便geom_bar()的默认颜色不是黑色。

I'd like to define a theme for ggplot2 so that the default colour of geom_bar() is not black.

我该怎么做?

推荐答案

你不能在主题中做到这一点(可悲)。

you can't do it in a theme (sadly).

您想要更改geom的默认设置,

You want to change the default settings of a geom,

  update_geom_defaults("bar",   list(fill = "red"))

您也可以更改默认比例,例如

and you can also change a default scale, e.g.

  scale_colour_continuous <- function(...) 
         scale_colour_gradient(low = "blue", high = "red", na.value="grey50", ...)

这篇关于ggplot2:如何在主题中设置geom_bar()的默认填充颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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