[R] Y-Axis Label Overwritten By TickMark Values

Paul Roebuck roebuck at wotan.mdacc.tmc.edu
Sat Oct 1 23:00:45 CEST 2005


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...

> 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.

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.

> 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.

----------------------------------------------------------
SIGSIG -- signature too long (core dumped)




More information about the R-help mailing list