I've been wondering about that too. It's a personal problem - my ability to distinguish color shades has decreased.
I've been dabbling with an alternative idea - stripy lines. Or at least alternating color segments. Then you don't have to rely on shades to make the distinction.
Lucia illustrated with some solar data from Leif Svalgaard. She used different dot-dash line styles to nelp make contrasts. I thought it would be really good to make these in alternating colors. You can do this by over-writing.
So here's what I came up with. Some may like it, some not. The lines are in principle more distinctive, but it's harder to see where they are going. Single contrasting colors are certainly better, if you can get enough of them.
Anyway, here's my plot. The R code is below the jump, and I'll put a zip file (TSIcolors.zip) with data on the doc repository. As Lucia noted, Leif's file just has blanks for missing data, so I edited the NA entries in.The colors are automatically and randomly chosen.
Peter O'Neill (oneillp) in comments suggested using R-supplied palettes. I think this is better, specifically rainbow(). He also suggested a way to fix the line segments in legend, using seg.len. I found my legend() function would not take that as an argument. I also found that the problem with lines only applied when in jpeg or png mode. I couldn't find the bug, so I wrote my own legend routine - using a subset of the regular arguments.
Update. Replacing the above update. I've redone in the spirit of Peter's second comment. Instead of a new legend function, I use the values returned by the the standard oneto overwrite the line segs. I don't then need to use seg.len
Revised pictures and code below.
Here's a plot with thicker lines.
And here is the (revised) code:
# File from https://www.leif.org/research/TSI%20%28Reconstructions%29.txt
# Blanks have been converted to NA
N=dim(w)-1 # Number of curves
cl=matrix(cl[round(outer(1:N*3-3,0:2*N,"+")/3)%%N+1],N,3) ## Make orthog colors
# Now make dash patterns
lw=4 # line width
### Now plotting
#Now plot curves 3 times with 3 different colors and dash patterns
for(i in 1:N)for(j in 1:3)lines(x,w[i+1,], col=cl[i,j], lty=lt[i,j], lwd=lw)
# Now plots legend, also 3 times
L = legend(1970,1364.74, legend=names, cex=1.0, text.col=cl[,1], col="white",lty=lt[,1])
for(i in 1:N) for(j in 1:3) lines(x,rep(L$text$y[i],2),col=cl[i,j],lty=lt[i,j],lwd=lw)