简体   繁体   中英

Set the intervals of x-axis using r

I plot a distribution of visit time of a scenic spot from 0 to 23 hours in a day. And I want to adjust the intervals of x-axis letting all hours be displayed. How can I do that?

d = c(42,13,10,3,2,6,7,15,38,63,128,153,178,181,236,217,272,417,526,653,607,385,191,70)
plot(seq(0,23,by=1),c,type='b',col='red',main="Confucius Temple",xlab="Hours",ylab="Numbers of check-in")

在此输入图像描述

You can use axis :

> axis(side=1, at=c(0:23))

That is, something like this:

plot(0:23, d, type='b', axes=FALSE)
axis(side=1, at=c(0:23))
axis(side=2, at=seq(0, 600, by=100))
box()

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