[R] Organising tick-marks in plot()

(Ted Harding) Ted.Harding at manchester.ac.uk
Fri Nov 30 12:55:20 CET 2007

Hi Folks,
I'm advising someone who's a beginner with R,
and therefore wants the simplest answer possible.

The issue is to produce a plot using


where, on the X-axis, the tick-marks should be
on the lines of:

-- Range of X-axis: 0:1000
-- tick-marks labelled "0","200",...,"800","1000"
-- unlabelled tick-marks every 50 from 0 to 1000.

regardless of the actual range of x-values (which
however would normally range over most of 0:1000).

I've looked at the Q-Q Plot example in the MASS
book (Section 3.4), which does achieve this kind
of effect, but the code is too complicated for
the present context. (Whatever code is used needs
to be readily changeable for different plots of
the same general kind).

Is there a way of supplying straightforward
arguments to plot() which would achieve this?

I've been reading and site-searching for a while,
and the best I can find is on the lines of

  par(xaxp=c(0, 1000, 50))

which is already complicated enough in the present
context; but it doesn't do exactly what is required
since (for example) if the x-values range from
0 to 900 the labelled tick-marks are at

  0  60 140 220 300 380 460 540 620 700 780 860 940

and have therefore been computed from the range of
the data, and not from the specified range of the x-axis.

Help please!
Best wishes to all,

E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 30-Nov-07                                       Time: 11:55:16
------------------------------ XFMail ------------------------------

More information about the R-help mailing list