R - 自定义直方图中的 X 轴值

发布于 2024-12-21 05:41:34 字数 362 浏览 1 评论 0原文

我想更改 R 中直方图中 x 轴上的值。

计算机当前已将其设置为

0, 20, 40, 60, 80, 100.

我希望 x 轴移动 10,如下所示:

0,10,20,30,40,50,60,70,80,90,100.

我知道要摆脱当前轴,我必须这样做

(hist(x), .... xaxt = 'n')

并且那么

axis(side = 1) .....

我怎样才能让它显示我需要显示的数字呢?

谢谢。

I want to change the values on the x axis in my histogram in R.

The computer currently has it set as

0, 20, 40, 60, 80, 100.

I want the x axis to go by 10 as in:

0,10,20,30,40,50,60,70,80,90,100.

I know to get rid of the current axis I have to do this

(hist(x), .... xaxt = 'n')

and then

axis(side = 1) .....

But how do I get it to show the numbers that I need it to show?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稍尽春風 2024-12-28 05:41:34

答案就在 ?axis 中...

dat <- sample(100, 1000, replace=TRUE)
hist(dat, xaxt='n')
axis(side=1, at=seq(0,100, 10), labels=seq(0,1000,100))

The answer is right there in ?axis...

dat <- sample(100, 1000, replace=TRUE)
hist(dat, xaxt='n')
axis(side=1, at=seq(0,100, 10), labels=seq(0,1000,100))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文