R-自定义直方图中的X轴值
问题描述:
我想在R中的直方图中更改x轴上的值.
I want to change the values on the x axis in my histogram in R.
计算机当前将其设置为
0, 20, 40, 60, 80, 100.
我希望x轴像这样移动10倍:
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')
然后
axis(side = 1) .....
但是如何获取需要显示的数字呢?
But how do I get it to show the numbers that I need it to show?
谢谢.
答
答案就在?axis
...
dat <- sample(100, 1000, replace=TRUE)
hist(dat, xaxt='n')
axis(side=1, at=seq(0,100, 10), labels=seq(0,1000,100))