title: words in different colors?
2009/1/21 Michael Friendly <friendly at yorku.ca>:
In ?title I see the
plot(cars, main = "")
title(main = list("Stopping Distance versus Speed", cex=1.5, col="red",
font=3))
I can't seem to generalize this to use several colors in a single title.
Solution from http://tolstoy.newcastle.edu.au/R/e2/help/07/09/24599.html adapted for title: plot(1:10) title(expression("hair Color" * phantom(" and Eye color")),col.main="red") title(expression(phantom("hair Color and ") * "Eye color"),col.main="blue") title(expression(phantom("hair Color ") * "and" * phantom("Eye color"),col.main="black")) The trick is to overlay three titles, one for each colour, with the stuff not in that colour wrapped in a phantom() call to produce the correct spacing in invisible ink. There's probably other ways... Barry