Thanks for the reply.  I think I've figured it out, you can set this with
the mgp parameter.

So I'd use the following statement instead:

axis(1, at=foo$plot.x, labels=foo$plot.x, mgp=c(3,0.5,1)) #this brings the
axis labels closer to the axis line

Andrew

On Thu, Jun 12, 2008 at 9:53 AM, Toby Marthews <[EMAIL PROTECTED]>
wrote:

> Hi Andrew,
>
> Perhaps this example would help. You can add in spaces to the mtext text
> to move the text sideways.
>
> par(mai=c(0.5,0.5,0.5,0.5),oma=c(2,2,2,2))      #mai units are INCHES, oma
> units are LINES
> plot(runif(50),xlab="xlab",ylab="ylab",bty="l") #n.b. these labels don't
> appear
> mtext("First inner x axis label",side=1)
> mtext("First inner y axis label",side=2)
> mtext("Second inner x axis label",side=3)
> mtext("Second inner y axis label",side=4)
> mtext("First outer x axis label",side=1,outer=TRUE)
> mtext("First outer y axis label",side=2,outer=TRUE)
> mtext("Second outer x axis label",side=3,outer=TRUE)
> mtext("Second outer y axis label",side=4,outer=TRUE)
>
> Cheers,
> Toby Marthews
>
> Le Jeu 12 juin 2008 15:32, Andrew Yee a écrit :
> > Here's a naive question about axis()
> >
> > How do you control the location of the labels with the axis() command?
> >
> > In the following example:
> >
> > foo <- data.frame(plot.x=seq(1:3), plot.y=seq(4:6))
> > plot(foo$plot.x, foo$plot.y, type='n', axes=FALSE)
> > points(foo$plot.x, foo$plot.y)
> > axis(1, at=foo$plot.x, labels=foo$plot.x)
> >
> > I'd like to be able the control the y location of the labels (i.e. move
> up
> > or down in the graph).
> >
> > Thanks,
> > Andrew
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to