Re: [R] how to control ticks in plots with yasp or xasp

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sun 09 Oct 2005 - 01:37:40 EST

On Sat, 8 Oct 2005, Marc Schwartz wrote:

> On Sat, 2005-10-08 at 09:28 -0400, Denis Chabot wrote:
>> Hi,
>>
>> A few times I tried to control the number and position of tick marks
>> in plots with the yasp or xasp parameters. For example, a y axis was
>> drawn by default with tick marks at 0, 20, 40, 80 and 100. I tried to
>> get tick marks every 10 by adding
>>
>> yasp=(0, 100, 10)
>>
>> but this had no effect at all. I know I can draw the axis and tick
>> marks manually, but often this simple option would suffice if I could
>> understand how to make it work.
>>
>> Thanks in advance,
>>
>> Denis Chabot
>
>
> I suspect that one problem you are having is that there is no
> par("xasp") or par("yasp")....unless these are typos and you are trying
> to use par("xaxp") and par("yaxp")?

In any case, (0, 100, 10) is invalid syntax, and c(0, 100, 10) is needed.

> There is an 'asp' argument to some of the plot functions (ie.
> plot.default), but this has a different intention.
>
> par("xaxp") and par("yaxp") are not listed as read only pars in ?par,
> however, I cannot recall an instance where R does not overwrite the user
> settings during the calculation of the axes, whether passed as arguments
> to a plot function or set a priori via a par() call.

Really? Try

> plot(1:100, xaxt="n")
> par(xaxp=c(0, 50, 5)) # the value is reset at each plot
> axis(1)

for how it works (but not inline, which is probably a bug).

> If you want explicit control over the tick marks, you will need to use
> axis(), perhaps in combination with axTicks(), after using 'xaxt = "n"'
> and/or 'yaxt = "n"' in the plot call, depending upon the circumstances.

That is usually as easy.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sun Oct 09 01:54:32 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:40 EST