[R] How to divide too long labels?
attenka at utu.fi
Sat Mar 18 23:00:27 CET 2006
Thank you for answering, both Roger and Henrik
There are only 5 cases which need divisions, so I inserted \n to them and
now everything works.
> On 3/18/06, Atte Tenkanen <attenka at utu.fi> wrote:
>> Is there any possibility to divide too long text in a plot to two or
>> lines, when using labels-parameter in the text()-command?
>> Here is an example picture:
>> My example script is something like this:
>> text(1,0.7,labels=Chordnames[fnid(pcs%%12)]) # according to Larry
>> Solomon's table http://solomonsmusic.net/pcsets.htm
>> Chordnames is a long vector with long character strings.
> plot(1, xlab="First row\nSecond row")
> text(1,1, labels="First row\nSecond row")
> To insert a '\n' at sensible positions such as between two words, look
> at regexpr() and substring() and paste(). If you labels have a known
> pattern you might be able to use gsub().
>> Atte Tenkanen
>> University of Turku
>> R-help at stat.math.ethz.ch mailing list
>> PLEASE do read the posting guide!
> Henrik Bengtsson
> Mobile: +46 708 909208 (+1h UTC)
More information about the R-help