且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ggplot2:如何在主题中设置geom_bar()的默认填充颜色

更新时间:2023-01-28 12:50:38

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

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", ...)