Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R轴和轴标签之间的间距不相等_R_Plot - Fatal编程技术网

R轴和轴标签之间的间距不相等

R轴和轴标签之间的间距不相等,r,plot,R,Plot,我想知道为什么轴和轴标签之间的距离在两个轴上不同?如何解决这个问题?示例代码和下图 png("test.png",height=7,width=7,units="cm",res=300) par(mar=c(1,1,1,1)) par(mgp=c(1,0.2,0)) plot(x=1:10,y=1:10,axes=F,xlab="",ylab="") box() axis(side=1,cex.axis=0.5,tcl = -0.12) axis(side=2,cex.axis=0.5,tcl

我想知道为什么轴和轴标签之间的距离在两个轴上不同?如何解决这个问题?示例代码和下图

png("test.png",height=7,width=7,units="cm",res=300)
par(mar=c(1,1,1,1))
par(mgp=c(1,0.2,0))
plot(x=1:10,y=1:10,axes=F,xlab="",ylab="")
box()
axis(side=1,cex.axis=0.5,tcl = -0.12)
axis(side=2,cex.axis=0.5,tcl = -0.12)
dev.off()

您可以使用
padj
hadj
选项调整标签的位置:

axis(side=1,cex.axis=0.5,tcl = -0.12, padj=-1, hadj=0.5)
axis(side=2,cex.axis=0.5,tcl = -0.12, padj=0, hadj=0.5)

@RHA的可能副本当然不是该副本的副本答案在答案中