I would use axis
for both textA
and textB
, then play around with line
until you have an acceptable spacing.
EDIT: I don't know how to have different colours and fonts within a label. As a workaround, you can put both texts closely together by using text
with a variable x-position. If you resize the window, you might have to adjust the offsets.
par(mar=c(5,13,.25,1))
textA=seq(0,100,25)
textB=c("start","intermediate1","intermediate2","intermediate3","stop")
plot(c(0,runif(8),1),c(0,runif(8),1),axes=F,ylab=NA)
axis(1)
# add textA and textB
axis(2, at=seq(0,1,.25), labels=textB, font=3, col.axis=1,las=2,cex.axis=1.5, line=1)
text(x=c(-0.3,-0.55,-0.55,-0.55,-0.3), y=seq(0,1,.25), textA, xpd=NA, col=2, font=2, cex=1.5)
# check which offset we need for textA:
# abline(v=seq(-1,0,.1), xpd=NA, col=2)
# text(,x=seq(-1,0,.1),y=rep(0,11),labels=seq(-1,0,.1),xpd=NA)