Skip to content
Prev 178803 / 398506 Next

how to word-wrap text in labels in plots?

Hi Hans,
strwrap is your friend. "\n" inserts a cr in a line of text.

wordwrap<-function(x,len) paste(strwrap(x,width=len),collapse="\n")
par(mar=c(11,3,2,1))
tmp<-plot(c,axes=F)
axis(2)
axis(1,at=tmp,labels=sapply(levels(c),wordwrap,len=15),padj=1)
box()

For unique abbreviations see ?abbreviate

hth.


Hans Ekbrand schrieb: