使用r设定x轴的间隔 [英] Set the intervals of x-axis using r

查看:206
本文介绍了使用r设定x轴的间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我绘制了一天的游览时间从0到23小时的分布图.我想调整X轴的间隔,以显示所有小时数.我该怎么办?

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")

推荐答案

您可以使用axis:

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

就是这样:

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()

这篇关于使用r设定x轴的间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆