删除geom_text中的重复标签

时间:2017-08-11 07:53:37

标签: r ggplot2

我的数据如下:

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)

这给出了这个:

enter image description here

我希望每个作曲家只包含一个标签,而不是每个季节的标签。如何删除重复的标签?

0 个答案:

没有答案