r - Non-equidistant axis labels -


does know how adjust labels in base plot not equidistant? have tick marks @ different distance each other , want labels center between these. axis function's hadj argument takes 1 value.

just question has spelled-out answer (albeit different 1 suggested in comments):

ticks <- c(0, 1, 3, 6, 10) labels <- c("one", "two", "three", "four") # 1 fewer ticks label.positions <- ticks[-1] - diff(ticks) / 2 plot(1:10, 1:10, xlim=c(-1, 11), axes=false, ann=false) axis(1, at=ticks, labels=false) axis(1, at=label.positions, labels=labels, tick=false) 

screenshot of plot unequally spaced axis ticks , axis labels centered between ticks


Popular posts from this blog