解决方案
列数字?您可以使用 breaks
参数添加 scale_x_continuous
来指定x轴刻度的位置。我不知道图像中年份的范围是什么,但是如果是从1900年到2000年(例如),您可以这样做:
ggplot(prova,aes(x = year,y = mass..g。))+
geom_line(aes(group = 1))+
scale_x_continuous(breaks = seq 1900,2000,10))
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 10 years, for example?
This is my command:
ggplot(prova, aes(x=year, y=mass..g.)) + geom_line(aes(group = 1))
解决方案
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))
这篇关于如何不显示ggplot轴上的所有标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!