[R] Labels perpendicular to axis

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri May 25 08:22:04 CEST 2001

s-luppescu at uchicago.edu wrote:
> I would like to make my horizontal barplot vertical axis labels perpendicular to
> the axis. I tried las=1, srt=90; I even tried yaxt='n' thinking I'd put the
> labels in using mtext, but the axis continued to be drawn. Can anyone help me
> with this? My barplot() statement looks like this:
> barplot(height=foo$rebint[o1], names=foo$Unit[o1], horiz=TRUE,
> col=mycolors[foo$type[o1]], yaxt='n')

You can change the last few lines of barplot.default():
  if (axes) 
    axis(if (horiz) 1 else 2, ...)

Or to avoid plotting the axis:

1. You can say barplot(..., axes = FALSE)

2. You can use a workaround:

Uwe Ligges
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