我有一个条形图,因为高度过高,它会切断数据标签 大于其他数据点。我想调整高度,以便 标签可见。
season batsman total_runs
<int> <chr> <int>
1 2016 V Kohli 973
2 2018 KS Williamson 747
3 2012 CH Gayle 733
4 2013 MEK Hussey 733
5 2019 DA Warner 727
6 2014 RV Uthappa 660
7 2017 DA Warner 641
8 2010 SR Tendulkar 618
9 2008 SE Marsh 616
10 2011 CH Gayle 608
11 2009 ML Hayden 572
12 2015 DA Warner 562
我尝试过ylim,但不适用于我的情况。
season_top_scorer <- match_full%>%
group_by(season,batsman)%>%
summarize(total_runs = sum(batsman_runs))%>%
arrange(season,desc(total_runs))%>%
filter(total_runs == max(total_runs))%>%
arrange(desc(total_runs))%>%
ggplot(aes(x = season,y = total_runs,fill = batsman))+
geom_bar(stat ="identity")+
ggtitle("Highest run scorer each season")+
theme(axis.text.x = element_text(angle = 90, hjust = 1))+
scale_x_discrete(name="Season",
limits = c(2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019))+
geom_text(aes(label= total_runs,vjust= 0 ))+
scale_y_discrete(name = "Total Runs", limits = c(0,250,500,750,1000,1250))
唯一的问题是2016年赛季。酒吧的高度太大,以至于 它切断了标签。任何想法都可以解决这个问题 以上代码