簡體   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