[R] multiple colors within same line of text

John Kane jrkrideau at yahoo.ca
Fri Aug 17 13:24:55 CEST 2007


Hi Andrew,

This is pretty clumsy but it seems to work.  I suspect
there are many better ways

x <- seq(0, 1, length=21)
plot(db)
colour <- c("red", "blue")
mytext <- c("RED", "BLUE")
mtext( mytext, at= c(2,5), side=1, col=colour)

--- Andrew Yee <andrewjyee at gmail.com> wrote:

> Hi, I'm interested in using mtext(), but with the
> option of having multiple
> colors in the same line of text.
> 
> For example, creating a line of text where:
> 
> Red is red and blue is blue
> 
> How do you create a text argument that lets you do
> this within mtext()?
> 
> Thanks,
> Andrew
> MGH Cancer Center
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>



More information about the R-help mailing list