r - 使用 r 设置 x 轴的间隔

标签 r plot

我绘制了一个景点一天中0到23小时的访问时间分布。我想调整 x 轴的间隔以显示所有小时。我怎样才能做到这一点?

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

enter image description here

最佳答案

您可以使用:

> 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 - 使用 r 设置 x 轴的间隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15717545/

相关文章:

r - 在R中绘制多元Logistic回归模型的结果

matplotlib - Matlab 在 Julia 中的 "hold on"

r - R中的多个条件过滤

r - 处理相关性计算的缺失值

r - 按组,将值与特定值匹配

R Markdown : writing html with variables

r - cat() 中的这个空间来自哪里

matlab - 在 3D 图形中的点处从向量添加文本

r - 在 R 中一口气针对不同图中的一个特定列绘制数据框的所有列

R图密度ggplot vs plot