Dear Julia, Try this: plot(1:10) legend("topleft", legend=c("g1", "g2", "g3"), col=c('black','red','blue'), lty=1,lwd=1.5)
# or plot(1:10) legend("topleft", legend=c("g1", "g2", "g3"), text.col=c('black','red','blue'),ncol=3) HTH, Jorge On Tue, Sep 30, 2008 at 3:03 PM, liujb <[EMAIL PROTECTED]> wrote: > > Hello, > > I have a time series plot drawn using 3 different colored lines, each line > corresponds to different category group. I'd like to put legends on the > plot. I am using "legend" to do this, however, I can either specify lty or > col in legend. Will I be able to do the following in the legend box: a > solid > black line then g1, a solid red line then g2, a solid blue line then g3? > > plot(g1, ylim=c(0,10)) > lines(g2, col="red") > lines(g3, col="blue") > legend(locator(n=1), legend=c("g1", "g2", "g3"), ???) > > Thank you very much, > sincerely > Julia > > -- > View this message in context: > http://www.nabble.com/Adding-legends-to-a-plot-tp19748373p19748373.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > [[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.