[R] location of multi-line labels on barplots?

Paul Murrell paul at stat.auckland.ac.nz
Mon Apr 23 23:28:56 CEST 2001


> Hi, All.  I have a barplot I am making that has a 2 line label:
> names(GC) <- c("Read-Off", "Spatial\n Transformations", "Vis Changes",
"Plans", "Abandon")
> and here, Spatial Transformations should be on 2 separate lines.
> However, when I break it as above (with the \n), the "Spatial" part is
> pushed up so that it overlaps the Tick mark there.  I can get rid of
> the tick mark, but I'd rather not...
> Is there a way to push the labels down a hair so they don't overlap
> with the tick marks?

Does the following do the sort of thing you want ?

    midpts <- barplot(1:4)
    axis(1, at=midpts, labels=c("a", "b", "", "d"))
    mtext("one\ntwo", side=1, at=midpts[3], line=2)

(if it does, but you can't see why, please feel free to ask for further
explanation :)


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

More information about the R-help mailing list