[R] coloured letters in a text

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Aug 28 14:10:38 CEST 2008

2008/8/28 Fränzi Korner <fraenzi.korner at oikostat.ch>:

> example 1:
> I would like to add the word "ABC" to a figure. Thereby each letter should
> have a different colour.
> text(x,y,"ABC", col=c(1,2,3))  # this does not work

kludge alert!

 How about:

 Basically this overlays three coloured texts to give the impression
of individual coloured letters. This may or may not be practical for
your real application. It's also possible that if you print this your
printer will end up printing "A" with a mix of colours 1, 2 and 3.

 If your font is monospaced you could do it with text(x,y,"
C",col=3), but in a pretty font the letters AB wont have the same
width as two spaces.


More information about the R-help mailing list