[R] distance betwenn axis and axis annotation
mark_difford at yahoo.co.uk
Wed Feb 18 13:50:27 CET 2009
Duncan Murdoch wrote:
>> I don't think you can do this directly, but you can do it using mtext.
This is not correct. You can, as Dimitris has already shown. See ?par (sub
mgp). The difficulty arises if you want only one set of axes changed, which
is not what was requested.
## Example using your "example"
par(mfrow = c(1, 2))
x <- 1:10
y <- rnorm(10)
at <- pretty(x)
min <- par("usr")
max <- par("usr")
at <- at[ at >= min & at <= max] # pretty extends the range
axis(1, at=at, labels=FALSE)
mtext(at, side=1, at=at, line=3)
plot(x, y, mgp = c(3, 3, 0))
Duncan Murdoch-2 wrote:
> Luis Ridao Cruz wrote:
>> How can I specify the distance between the axis and axis annotation?
> I don't think you can do this directly, but you can do it using mtext.
> For example:
> x <- 1:10
> y <- rnorm(10)
> plot(x,y, axes=F)
> at <- pretty(x)
> min <- par("usr")
> max <- par("usr")
> at <- at[ at >= min & at <= max] # pretty extends the range
> axis(1, at=at, labels=FALSE)
> mtext(at, side=1, at=at, line=3)
> Duncan Murdoch
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://www.nabble.com/distance-betwenn-axis-and-axis-annotation-tp22076797p22077914.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help