如何在geom_bar中更改AE的颜色填充
我有以下代码:
ggplot(aes(x = Education)) +
geom_bar(aes(fill = P_3_1, P_3_2)) +
facet_wrap(~Education) +
labs(y = 'Qunatity', title = 'Answers for group "P_3"
based on education') +
theme_bw()
我想以下面的方式获得GEOM_BAR,并具有两种颜色。 是可能的还是代码的这一部分:fill = p_3_1,p_3_2 需要更改吗? 我只有一个彩色的灰色条。
I have below code:
ggplot(aes(x = Education)) +
geom_bar(aes(fill = P_3_1, P_3_2)) +
facet_wrap(~Education) +
labs(y = 'Qunatity', title = 'Answers for group "P_3"
based on education') +
theme_bw()
I want to get geom_bar as below with two colours.
Is that possible or this part of code: fill = P_3_1, P_3_2
needs to be changed?
I'm getting just one coloured gray bars.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您可以提供这样的小示例,那就更好了。您的填充可能是下面的单列?
在2022-05-05上由 reprex软件包(v2.0.1)
It's better if you can provide a small reproducible example like this. Your fill probably needs to be a single column per below?
Created on 2022-05-05 by the reprex package (v2.0.1)