How to not show all labels on ggplot axis?

后端 未结 4 1337
自闭症患者
自闭症患者 2020-12-09 02:12

I\'m trying to using ggplot2 to plot this: But as you can see on the x axis you can\'t read anything...

So how can I show on the x axis the value every

4条回答
  •  执笔经年
    2020-12-09 02:50

    Is your year column numeric? You can add scale_x_continuous with a breaks argument to specify where the x axis ticks should be. I can't tell what the range of years is in the image, but if it's from 1900 to 2000 (e.g.) you can do something like this:

    ggplot(prova, aes(x=year, y=mass..g.)) +
        geom_line(aes(group=1)) +
        scale_x_continuous(breaks=seq(1900, 2000, 10))
    

提交回复
热议问题