简体   繁体   中英

Add labels to X axis

I made a plot and it turned out fine besides the X axis labels. I want all the labels to be shown on the plot and for some reason the plot only shows some of them.

Following my code:

plot(seq(2001,2015,1), sunday_mean, pch=16,
     main="Mean values for all the roads going in Beer Sheva",
     xlab="Year",
     ylab="Appearences")`

And here, the plot I get: 我的情节

Check out axis to mess with the tick marks/labels.

sunday_mean <- rnorm(15, 13) + cumsum(rnorm(15,-0.05))

plot(seq(2001,2015,1), sunday_mean, pch=16,
     main="Mean values for all the roads going in Beer Sheva",
     xlab="Year",
     ylab="Appearences")

axis(1, at=(x=seq(2001,2015,1)), label=paste(x))

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM