My xyplot() with superposed multiple condiions looks better with lines than with points (it's easier to see changes over time with the lines). But, there are gaps in the years (the x axis) for which there are data to be plotted. For example, there are data for years 2004-2006 and 2010-2012, but not for 2007-2009. I would like to have the lines for only the two groups with data. Reading ?xyplot suggests that the group attribute might do the job but I do not see how to write the equation. Is it possible to plot with lines on discontinuous data or should I use large, solid circles for each year's data points? Rich
Hi Rich This is a case of where data needs to be supplied to go further. Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Rich Shepard Sent: Friday, 6 September 2013 06:24 To: r-help at r-project.org Subject: [R] xyplot() with discontinuous x-axis variable My xyplot() with superposed multiple condiions looks better with lines than with points (it's easier to see changes over time with the lines). But, there are gaps in the years (the x axis) for which there are data to be plotted. For example, there are data for years 2004-2006 and 2010-2012, but not for 2007-2009. I would like to have the lines for only the two groups with data. Reading ?xyplot suggests that the group attribute might do the job but I do not see how to write the equation. Is it possible to plot with lines on discontinuous data or should I use large, solid circles for each year's data points? Rich ______________________________________________ R-help at 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.
> My xyplot() with superposed multiple condiions looks > better with lines than with points (it's easier to see > changes over time with the lines). But, there are gaps in the > years (the x axis) for which there are data to be plotted. > For example, there are data for years 2004-2006 and > 2010-2012, but not for 2007-2009. I would like to have the > lines for only the two groups with data. > > Reading ?xyplot suggests that the group attribute might do > the job but I do not see how to write the equation.#Test data ym <-as.data.frame(expand.grid(Y=c(2004:2006, 2010:2012), A=1:4)) #A is an arbitrary variable to give us some panels. ym$x <- runif(nrow(ym)) library(lattice) #Plots without, andf with, a groups argument xyplot(x~Y|A, data=ym, type="l") xyplot(x~Y|A, data=ym, type="l", groups=ym$Y<2007) Is that what you had in mind? S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}