[R] suppressing non-integer labels for plot x-axis

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Feb 19 14:24:24 CET 2004

Jonathan Williams wrote:

> Dear R-helpers,
> I am having difficulty making R plot only integer labels on the x-axis
> of a simple graph. I want to plot the median values of a score on each
> of three occasions. Non-integer occasions are impossible. But, R keeps
> labelling the x-axis with half-occasions, despite my attempts to stop
> this using the "xaxs" and "xaxp" parameters of 'plot'.
> p1=c(1,2,3); p2=c(5,15,25)
> plot(p1,p2,xlab='Occasion', ylab='Score', xlim=c(1,3), ylim=c(0,30),
> xaxp=c(1,3,3), xaxs='r')
> Could someone let me know how to suppress the non-integer labels?

In this case supress the drawing of the x-axis and specify it 
explicitly, see ?axis:

plot(p1, p2, xlab='Occasion', ylab='Score', xlim=c(1,3), ylim=c(0,30), 
axis(1, at=1:3)

Uwe Ligges

More information about the R-help mailing list