我想知道在我下面的图中,Y轴的是什么?Y轴应该由七个值组成(.1,1,10,100,1000,10000,1000000)?但他们在情节上没有正确显示?
这是我的R码?
plot(1, 1, type = "n", xlim = c(0,1.5), ylim = c(.1, 100000), ann=F,bty="n",yaxt="n")
axis(side=2, at = 10^(-1:5),label=c(format(10^(-1:5),scientific=F) ))发布于 2017-02-02 01:24:56
您需要使用log="y"参数将y轴指定为对数刻度:
plot(1, 1, type = "n", xlim = c(0,1.5), ylim = c(.1, 100000), ann=F, bty="n", log="y", yaxt="n")
axis(side=2, at = 10^(-1:5),label=c(format(10^(-1:5),scientific=F) ) )发布于 2017-02-02 01:27:42
事实上,我看到你在最后一个问题上留下了评论,所以我也在那里添加了一个评论。是天平的问题。0.1、1和10都聚集在一起,因为只有显示第一个标签的空间。这段代码将给我更多的标签,但理想的方法是在日志比例尺中这样做:
axis(side=2, at = 10^(-1:5),label=c(format(10^(-1:5),scientific=FALSE)),las=1)发布于 2017-02-02 01:29:35
轴函数非常努力地尝试不存在重叠标签,而不重叠的规则包含一个空白区域,因此您可以开始看到标签数量的差异,这将随着cex.axis的减少而适应。
axis(side=2, cex.axis=0.7, at = 10^(-1:5),label=c(format(10^(-1:5),scientific=F) ))
axis(side=2, cex.axis=0.6, at = 10^(-1:5),label=c(format(10^(-1:5),scientific=F) ))https://stackoverflow.com/questions/41992715
复制相似问题