在条形图r中可见两个数据

发布于 2025-02-01 04:16:13 字数 559 浏览 1 评论 0原文

新手到这里。尝试使用以下代码绘制此数据,但遇到问题,因为数据正相互重叠。理想情况下,我想在每个条上看到两个数据,但是目前,更大的价值在主导。有什么办法可以更改不透明棒或解决问题?

{ggplot(data_income_BA) +
        geom_col(aes(x = Degree, 
                 y = Male,),
                 fill = 'blue',
                 width = 0.7) +
        geom_col(aes(x = Degree,
                 y = Female),
                 fill = 'red',
                 width = 0.7) +
        theme_classic() +
        ggtitle("Gender Divide",
                subtitle = "BA ") +
        labs(x = "Degrees", 
             y = "Male + Female")}

Newbie to R here. Trying to plot this data using the code below, but running into a problem in that the data is being overlapped by each other. Ideally, I would like to see both pieces of data on each bar, but currently, the greater value is dominating. Is there any way to change the opacity bars or solve the issue?

{ggplot(data_income_BA) +
        geom_col(aes(x = Degree, 
                 y = Male,),
                 fill = 'blue',
                 width = 0.7) +
        geom_col(aes(x = Degree,
                 y = Female),
                 fill = 'red',
                 width = 0.7) +
        theme_classic() +
        ggtitle("Gender Divide",
                subtitle = "BA ") +
        labs(x = "Degrees", 
             y = "Male + Female")}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文