> Why use color when you can use black and label the curves where they are > most separated? This solves problems with color blindness, xeroxing, and > faxing. > Where should I put the labels in this example:
> set.seed(123) > z=matrix(runif(6*50),50,6) > matplot(z,type='l',col=1,lty=1) A label is only going to indicate which curve is which at a point. If the curves approach or cross anywhere you're going to get confused. Line styles and colours persist along the length of the line. For nice smooth well-behaved curves then perhaps labelling is okay - contour lines rarely cross, and even when they do they must have the same height value anyway. I'm not sure once you get to six lines on a graph you can find six distinctive line styles without using colour, so it might be better to switch graphic completely. Compare the above plot with image(z). If the plots don't cross, one solution is to extend the plot to the right and just add labels there: > set.seed(123) > z=matrix(runif(6*50),50,6) > m=apply(z,1,cumsum) > ms=apply(m,1,sort) > matplot(ms,type='l',xlim=c(0,55),lty=1,col=1) > text(50,ms[50,],c("Foo","Bar","Baz","Qux","Quux","Quuux"),adj=-0.1) I can't see a neater way of putting labels actually on the lines in this case - they'll be all over the place to squeeze them in the gaps. Barry [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.