我的数据如下所示:
composerName season Location Time Venue eventType id conductorName interval movement workTitle
1 Anthem, 1918-19 55 55 55 55 55 55 55 55 55
2 Beethoven, Ludwig van 1912-13 37 37 37 37 37 37 37 37 37
3 Beethoven, Ludwig van 1915-16 38 38 38 38 38 38 38 38 38
4 Beethoven, Ludwig van 1919-20 38 38 38 38 38 38 38 38 38
5 Beethoven, Ludwig van 1920-21 36 36 36 36 36 36 36 36 36
6 Beethoven, Ludwig van 1921-22 44 44 44 44 44 44 44 44 44
我的代码如下所示:
ggplot(aes(x = composerName, y = id, fill = season, label = composerName), data = music)+
geom_bar(stat = 'identity')+
geom_text(angle = 90, position = position_dodge(width = 1), hjust = -.1)
这给出了这个:
我希望它只包含每个作曲家一个标签,而不是每个季节一个标签。如何删除重复的标签?
想通了:我需要包括stat = 'identity'
in geom_text()
:
ggplot(aes(x = composerName, y = id, fill = season, label = composerName), data = music)+
geom_bar(stat = 'identity')+
geom_text(stat = 'identity', angle = 90,
position = 'identity', hjust = -.2, check_overlap = TRUE)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)