I would like to create a very simple plot.
I am using this data:
a <- read.table("https://dl.dropbox.com/u/22681355/a.csv", sep=',', header=TRUE)
plot(a$X25, type="l",col="red", ylim=c(0,100))
lines(a$X25.1, type="l", col="blue")
lines(a$X25.2, type="l", col="green")
lines(a$X25.3, type="l", col="brown")
Now I would like to add a simple legend that indicates which color is which variable.
I understand that I can use the legend()
command, but my problem is that I don't know how to put colors next to the text in the legend.
What's the simplest command that would do this?
question from:
https://stackoverflow.com/questions/14883238/adding-simple-legend-to-plot-in-r 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…