繁体   English   中英

在ggplot R中标记geom_bar

[英]Labels geom_bar in ggplot R

我有这个代码

ggplot(authors_interest_sex_count, aes(Country, freq, fill=Gender)) + 
geom_bar(stat="identity", position="dodge") + geom_text(aes(label = freq), vjust=-1)

我得到了这张图片: 在此处输入图片说明

如您所见,每个国家/地区的标签都是完全垂直的,我认为最佳解决方案是将每个标签放在其列的顶部。 我应该更改或添加什么代码? 提前致谢!

正如RomanLuštrik所说,我一直在寻找答案

ggplot(authors_interest_sex_count, aes(Country, freq, fill=Gender)) + 
geom_bar(stat="identity", position="dodge") + 
geom_text(aes(label = freq), position=position_dodge(width=0.9), vjust=-1)

在此处输入图片说明 谢谢!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM