Suppose I have the bottom axis of a plot that looks like:
----+----+----+----+----+----+----
| | | | | |
1 2 3 4 5 6
Axis title
1. How do I reduce the gap between the ends of the ticks and the axis
labels (numbers)?
2. How do I vary the gap between the bottom of the axis labels and the top
of the axis title?
I have looked in various places (help for par, axis, plot) but haven't
found the solutions. Thanks for any help.
Bill Simpson
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi
I think you want par(mgp). For example, try ...
par(mfrow=c(2,2), mar=rep(6,4), mgp=c(3, 1, 0))
plot(1:10, xlab="default position", ylab="default position")
box("figure", lty="dashed")
par(mgp=c(4, 1, 0))
plot(1:10, xlab="axis label further out", ylab="axis label
further out")
box("figure", lty="dashed")
par(mgp=c(4, 2, 0))
plot(1:10, xlab="tick labels further out too", ylab="tick labels
further out
too")
box("figure", lty="dashed")
par(mgp=c(1.5, .6, 0))
plot(1:10, xlab="both labels closer in", ylab="both labels closer
in")
box("figure", lty="dashed")
For finer control, you will probably need to use mtext() to draw the labels
yourself.
Hope that helps.
Paul
> Suppose I have the bottom axis of a plot that looks like:
>
> ----+----+----+----+----+----+----
> | | | | | |
>
>
> 1 2 3 4 5 6
>
>
> Axis title
>
> 1. How do I reduce the gap between the ends of the ticks and the axis
> labels (numbers)?
>
> 2. How do I vary the gap between the bottom of the axis labels and the top
> of the axis title?
>
> I have looked in various places (help for par, axis, plot) but haven't
> found the solutions. Thanks for any help.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks everyone par(mgp) was what I needed.
BTW in my particular case using layout() I am now doing
par(mar=c(3,3,.2,.2))
par(mgp=c(3,.5,0))
I find that if I try
par(mgp=c(2.5,.5,0))
^^^
or any number <3 I get what looks like random small fragments of text
superimposed on the axis label. Looks like a photocopy taken with a
machine that has specks of dirt in it.
Bill Simpson
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._