mtext
to add plotting labels to an axis, after first
adjusting the labels so that the text does not overlap.
mtext.no.overlap(mtext.call, min.cex, min.trunc, min.gap=1)
mtext
(will be
called with
do.call("mtext", mtext.call)
after adjustment).
Must contain
cex
,
text
,
side
,
adj
,
srt
,
font
, and
at
elements.
cex
plotting parameter to use to avoid
overlaps.
mtext
.
mtext
.
The function first checks to see if the label strings will overlap
or not have the required gap between them. If they overlap, it
first tries to avoid overlaps by reducing the
cex
parameter
down to
min.cex
. If that still leaves overlapping labels,
label strings will be truncated down to minimum fraction
min.trunc
.
If they still overlap, alternate labels will be dropped. Then
mtext
will be called with the remaining labels and new
cex
.
plot(1:10) mtext.no.overlap(list(cex=1, text=rep("hellooooo",5), side=1, adj=0.5, srt=0, at=seq(1,2,length=5), font=par("font"), line=3), min.cex=1, min.trunc=.6)