如何更改geom_bar绘图的默认填充设置

时间:2022-10-07 15:02:44

Greetings, I am trying to create a bar chart of the data posted below (referred to in my code as topTwoTable), disaggregated by group type. I've scanned through multiple online forums, as well as Hadley's website, and stuck when it comes to manually altering the fill color of the bars on the basis of treatment type.

问候,我正在尝试创建下面发布的数据的条形图(在我的代码中称为topTwoTable),按组类型分解。我已经通过多个在线论坛以及Hadley的网站进行了扫描,并且在根据治疗类型手动更改条形的填充颜色时遇到了困难。

Any thoughts?

有什么想法吗?

Cheers, Aaron

干杯,亚伦

1 个解决方案

#1


1  

You'll want to specify your colors with "scale_colour_manual"

您需要使用“scale_colour_manual”指定颜色

http://had.co.nz/ggplot2/scale_manual.html

http://had.co.nz/ggplot2/scale_manual.html

I believe adding the following to the end of your current code should work.

我相信在当前代码的末尾添加以下内容应该可行。

+ scale_colour_manual(values = c("light blue"," dark blue"))

#1


1  

You'll want to specify your colors with "scale_colour_manual"

您需要使用“scale_colour_manual”指定颜色

http://had.co.nz/ggplot2/scale_manual.html

http://had.co.nz/ggplot2/scale_manual.html

I believe adding the following to the end of your current code should work.

我相信在当前代码的末尾添加以下内容应该可行。

+ scale_colour_manual(values = c("light blue"," dark blue"))