自1893年以来,我有两支球队在赛季末的足球赛季联赛排名的折线图。赛季(格式为18XX / XX)是一个因素。该图表绘制了自1893/94年以来的每个季节的坐标轴。太拥挤了。有什么办法可以省略轴标签?
理想情况下,我希望他们每十年来纪念一次,例如1900 / 01、1910 / 11。
这是代码:
ggplot(Mydata, aes(x = Season, y = value)) +
geom_line(aes(colour = variable, group = variable)) +
scale_y_continuous(trans = "reverse") +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
labs(title = "Blades vs Owls. End of season league position since 1892/93",
x = "Season", y = "League position")
此代码的添加为我修复了此问题:
+ scale_x_discrete(breaks = c("1893/94", "1900/01", "1910/11", "1920/21",
"1930/31", "1938/39", "1950/51", "1960/61",
"1970/71", "1980/81", "1990/91", "2000/01",
"2010/11", "2020/21"))