In R I would like to make some graphs in which I use multicoloured lines as in the examples below. Perhaps I could do this using different lines placed next to each other, but the problem is that it is hard then to use the correct line width so that they are placed exactly next to each other without any white space in between (since the lwd argument of lines in the R graphics package is not in absolute coordinates). Is there perhaps any other way to specify that I would like to draw a single line with two or three (or more) different colours? (ideally corners and line cappings should look OK)
cheers, Tom
PS the application I am working on is to be able to draw phylogenies with polymorphic states as in the image below