mindlessgreen
mindlessgreen

Reputation: 12102

R Unequal spacing between axes and axes labels

I would like to know why the distance between the axes and axes labels differs on both axes? How can this be fixed? Sample code and figure below.

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

figure

Upvotes: 2

Views: 459

Answers (1)

ds440
ds440

Reputation: 891

You can adjust the position of labels with the padj and hadj options:

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)

Upvotes: 1

Related Questions