[R] Y-Axis Label Overwritten By TickMark Values

Marc Schwartz MSchwartz at mn.rr.com
Sun Oct 2 00:03:25 CEST 2005

On Sat, 2005-10-01 at 16:00 -0500, Paul Roebuck wrote:
> On Sat, 1 Oct 2005, Marc Schwartz wrote:
> > On Sat, 2005-10-01 at 06:07 -0500, Paul Roebuck wrote:
> >
> > > Can someone tell me how to fix the left margin of plot region
> > > such that the tick values don't overwrite the x-axis label?
> > > I haven't been able to set the correct par option to fix this...
> >
> > This is the Y axis label, not the X axis.
> Oops. I'd been up all night...

Been there, done that...  ;-)

> > Set par("mar") prior to creating the plot to increase the left
> > hand margin space and then use mtext() rather than title() to
> > move the Y axis label further left by using the 'line' argument.
> >
> > [SNIP code]
> >
> > See ?par and ?mtext for more information.
> What a black art. Pray tell where you learned this that I
> may study there as well. In at least one of my prior attempts,
> I had used par("mar") but hadn't realized that title(ylab)
> would have to be changed; it just didn't seem (to me anyway)
> like wanting to display slightly larger numbers as tickmark
> values would have required using other low-level plot commands.

Look under the Documentation/Manuals link on the R Home page and read
through "An Introduction to R". That's the place to start.

Searching the e-mail list archives is yet another resource:


There is also a relatively new R Graphics Gallery (with code) here:


<shameless plug>

  Paul Murrell's new book "R Graphics"

  More info here:


</shameless plug>

> After about a hour of trying different options, I found myself
> really wanting to use the "R Plot Wizard(TM)" that lets you
> interactively set the LAF of the plot, then generates the
> appropriate R code to make it so.

No MS-like Wizards here...Only the intelligent human ones  ;-)

> > BTW, I would not use 'tcl = 0.3' which, as a positive value,
> > places the tick marks themselves within the plot region.
> > That's contrary to typical guidance, since the tick marks
> > get lost in this plot and more importantly, can overwrite
> > data points in certain plot types.
> Was emulating Matlab's plot output and that's how it places
> tickmarks (for better or worse). I actually needed to place
> tickmarks on all sides but hadn't found that option yet.

I'd say for worse...See Cleveland and/or Tufte for references. There is
a foundational reason for the way R does things: Sensible Defaults.

See ?axis (using 'side = 3' and 'side = 4') for more information here.


Marc Schwartz

More information about the R-help mailing list