我知道如何将柱状图的默认颜色更改为蓝色。
update_geom_defaults("bar", list(fill = "blue"))
但是如何更改 stat 组件呢?我已经尝试了。
update_geom_defaults("bar", list(stat = "identity"))
但是在我尝试ggplot() + geom_bar(...)
后,出现了错误信息Mapping a variable to y and also using stat="bin"
。我该如何更改默认值?
我注意到
> update_geom_defaults
function (geom, new)
{
g <- Geom$find(geom)
old <- g$default_aes()
aes <- defaults(new, old)
g$default_aes <- eval(substitute(function(.) aes, list(aes = aes)))
}
<environment: namespace:ggplot2>
似乎只将更新应用于美学方面。