From: Andrew Yee <yee_at_post.harvard.edu>

Date: Thu, 12 Jun 2008 11:08:35 -0400

R-help_at_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. Received on Thu 12 Jun 2008 - 15:44:54 GMT

Date: Thu, 12 Jun 2008 11:08:35 -0400

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 <Toby.Marthews_at_lsce.ipsl.fr> 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_at_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. Received on Thu 12 Jun 2008 - 15:44:54 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Thu 12 Jun 2008 - 16:30:38 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*