Hi I missed the original posting
I think to get the full picture we need to a reproducible example eg by dput of the data. To keep all the information about a plot you can use the par.settings argument which is an alternative to trellis.par.set(). Try names(trellis.par.get()) to get a list of all the arguments Or for an individual one trellis.par.get()$superpose.line # or trellis.par.get()[[21]] The legend colours lines and symbols are controlled by superpose.symbol, superpose.line and superpose.polygon so setting these can fix things. Eg par.settings = list(superpose.line = list(lty = 0:7, col = 1:8, lwd = 10)), The other alternative is to use the key argument eg key=list(text =list(...), lines=list(lty = 0:7, col = 1:8, lwd = 10), points = list(...)), I frequently put everything in par.settings when I have a simple panel function eg panel = function(x,y,...){ panel.abline(...) xyplot(x, y, ...) } or when the panel function is not required. Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Carl Witthoft Sent: Thursday, 21 November 2013 23:22 To: r-help@r-project.org Subject: Re: [R] Question on xyplot you didn't show us the code you used to generate the legend. I'm guessing you want to add to the legend list something like "lty=0:7" . KB wrote > I recently started using R, so I'm not really experienced with it. My > question is on adjusting xyplots to get lty lines instead of coloured > lines. > > My datasets looks about this: > year area species x > 1998 1 x1 0.005 > 1998 2 x2 0.006 > etc. > > year is factor from 1967 to 2013 > area is factor from 1 to 10 > species if factor, with 7 species > > the following code works: > xyplot(x~Year|Area, data=prob2, groups=Species, type="l", > auto.key=TRUE) > > but then I have all coloured lines. > > when I insert lty=0:7, col="black", it works, however my legend stays > with different colours > > What do I have to insert in my code to get black lty lines also in the > legend? > > Thanks in advance! -- View this message in context: http://r.789695.n4.nabble.com/Question-on-xyplot-tp4680833p4680888.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. ______________________________________________ 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.