[R] Position of Axis Labels (Base Graphics)

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Jun 10 11:06:33 CEST 2010

On 10.06.2010 11:02, Singmann wrote:
> Hi,
> I wonder if there is a way to selectively manipulate the position of the
> axis labels (i.e., the numbers). As far as I get it from ?par the only way
> to manipulate it is via mgp = c(x,y,z), where z is the relevant number.
> However, this manipulates the position of the axis labels for both the x-
> and y-axis.
> The reason I want to do this is that I have the impression that when using
> the standard values, the x-axis labels are somewhat further from the axis
> ticks than the y-axis labels. To make both more similar I would like to
> position the x-axis labels a little bit nearer to the axis.
> I know I can work around this problem by suppressing one axis (yaxt="n") and
> then adding it afterwards via axis(side=2,...). But I wonder if one cannot
> do this in a better way (hey, it is R).

Right, and axis() is the way to go.

Uwe Ligges

> Here is a plot where you should see the problem with the different distance
> of the labels from the axis ticks:
> plot(50,50,xlab="", ylab="", xlim=c(30,100), ylim=c(30,100), cex.axis=0.8)
> Thanks,
> Henrik Singmann

More information about the R-help mailing list