[R] plot + axis: Individually moving tick labels with hadj?

Marius Hofert m_hofert at web.de
Fri Jun 3 13:02:46 CEST 2011


Dear all,

consider the following plot:

plot(1:5, 5:1, xaxt="n") 
axis(1, at=1:5, labels=c(1,2,expression(3==beta[foooooo]),4,5))

the label at 3 is not nice, so consider this
plot(1:5, 5:1, xaxt="n") 
axis(1, at=1:5, labels=c(1,2,expression(3==beta[foooooo]),4,5),
     padj=c(0,0,0.18,0,0)) 

Now I tried to move the label horizontally so that the equality sign is 
vertically aligned with the tick. Since hadj moves all labels, I tried:
plot(1:5, 5:1, xaxt="n") 
axis(1, at=1:5, labels=c(1,2,expression(3==beta[foooooo]),4,5),
     hadj=c(0,0,0.22,0,0), padj=c(0,0,0.18,0,0))

Why is it not possible to individually move the labels horizontally?
Simply moving all of them does not look very good...
plot(1:5, 5:1, xaxt="n") 
axis(1, at=1:5, labels=c(1,2,expression(3==beta[foooooo]),4,5),
     hadj=0.22, padj=c(0,0,0.18,0,0))

Cheers,

Marius



More information about the R-help mailing list