r - Change the spacing of tick marks on the axis of a plot? -
how can change spacing of tick marks on axis of plot?
what parameters should use base plot or rgl?
there @ least 2 ways achieving in base graph (my examples x-axis, work same y-axis):
use
par(xaxp = c(x1, x2, n))orplot(..., xaxp = c(x1, x2, n))define position (x1&x2) of extreme tick marks , number of intervals between tick marks (n). accordingly,n+1number of tick marks drawn. (this works if use no logarithmic scale, behavior logarithmic scales see?par.)you can suppress drawing of axis altogether , add tick marks later
axis().
suppress drawing of axis useplot(... , xaxt = "n").
callaxis()side,at, ,labels:axis(side = 1, @ = v1, labels = v2).sidereferring side of axis (1 = x-axis, 2 = y-axis),v1being vector containing position of ticks (e.g.,c(1, 3, 5)if axis ranges 0 6 , want 3 marks), ,v2vector containing labels specified tick marks (must of same lengthv1, e.g.,c("group a", "group b", "group c")). see?axis, my updated answer post on stats.stackexchange example of method.
Comments
Post a Comment