Re: [R] Lattice: multiple data sets on same plot

2009-12-03 Thread Felix Andrews
As a non-statistician, here is my naive method: densityplot(~ value | cat1 * cat2, xx, groups = paste(variable, which), from = 0, to = 360, bw = 100, panel = function(x, ...) panel.densityplot(c(x-360,x,x+360), ...), plot.points = FALSE, auto.key = list(columns=2), par.settings = s

Re: [R] Lattice: multiple data sets on same plot

2009-12-03 Thread Joel Thomas
Thank you! Worked perfectly. Is it also possible to do the same but for circular data, for example, a density plot of circular object from the circular package using a trellis display. I have the same set of data but var1 and var2 are azimuth directions 0-360 so a standard density plot doesn't make

Re: [R] Lattice: multiple data sets on same plot

2009-12-02 Thread Felix Andrews
library(reshape) ## the easy way xx <- melt(x) head(xx) densityplot(~ value | cat1 * cat2, xx, groups = paste(variable, which), plot.points=FALSE, auto.key=list(columns=2), par.settings = simpleTheme(col = c("red","blue"), lty=c(1,1,2,2))) Hint: using multiple terms in t

[R] Lattice: multiple data sets on same plot

2009-12-02 Thread Joel Thomas
Hi, I have two data sets; one is a population and the other a sample of that population. I am trying to plot both on the same trellis display. # Example data set with two numerical attributes and two categorical pop <- data.frame(var1=rnorm(2000, 2000, 500), var2=rnorm(2000, 2000, 500)) cat<-(run