[R] How to define specific location of tick marks in plot()

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat May 22 20:40:53 CEST 2004


On Sat, 22 May 2004 DJNordlund at aol.com wrote:

> I wish to create a series of plots with the same x-axis range and the
> same placement of tick marks.  In addition I want to force the tick
> marks to be at specific locations.  For example, if I wish to have an
> x-axis which goes from 40 to 110, with tick marks at 40, 50, 60, ... ,
> How can I accomplish that?  The various parameters I have tried changing
> just seem to be suggestions for an internal definition.
> 
> I'm sure this is easy, but I'm obviously missing something in  the 
> docmentation.

par(xaxs="d") is what you want, but it is not currently implemented.  So 
for now use xaxt="n" and then call axis() with at=.

plot(20:120, 20:120, xaxt="n")
axis(1, at = seq(40, 110, 10))

-- 
Brian D. Ripley,                  ripley at 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




More information about the R-help mailing list