Hi,

I have created two separate overlapping density plots- see example code
below.
What I wish now to do is combine them into one figure where they sit side
by side.
Any help would be great!

many thanks in advance, josh.

#####################
thedataA <- data.frame(x1=rnorm(100,1,1),x2=rnorm(100,3,1)) #create data
thedataA.m<-melt(thedataA)

densityplot(~value, thedataA.m, groups=variable,auto.key=list(columns=2),
       panel = function(x, y, ...) {
               panel.densityplot(x, ...)
               panel.abline(v=0)
       }
)

thedataB <- data.frame(x1=rnorm(100,2,1),x2=rnorm(100,4,1)) #create data
thedataB.m<-melt(thedataA)

densityplot(~value, thedataB.m, groups=variable,auto.key=list(columns=2),
       panel = function(x, y, ...) {
               panel.densityplot(x, ...)
               panel.abline(v=0)
       }
)
######################

        [[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.

Reply via email to