There are at least two ways for achieving this in base graph (my examples are for the x-axis, but work the same for the y-axis):
-
Use
par(xaxp = c(x1, x2, n))orplot(..., xaxp = c(x1, x2, n))to define the position (x1&x2) of the extreme tick marks and the number of intervals between the tick marks (n). Accordingly,n+1is the number of tick marks drawn. (This works only if you use no logarithmic scale, for the behavior with logarithmic scales see?par.) -
You can suppress the drawing of the axis altogether and add the tick marks later with
axis().
To suppress the drawing of the axis useplot(... , xaxt = "n").
Then callaxis()withside,at, andlabels:axis(side = 1, at = v1, labels = v2). Withsidereferring to the side of the axis (1 = x-axis, 2 = y-axis),v1being a vector containing the position of the ticks (e.g.,c(1, 3, 5)if your axis ranges from 0 to 6 and you want three marks), andv2a vector containing the labels for the specified tick marks (must be of same length asv1, e.g.,c("group a", "group b", "group c")). See?axisand my updated answer to a post on stats.stackexchange for an example of this method.