Re: [R] Overlaying two graphs using ggplot2 in R

2014-01-28 Thread ONKELINX, Thierry
Dear Kristi, You could do something like this. ggplot(dat1, aes(x = factor(site), y = Present)) + geom_boxplot(aes(colour = layer)) + geom_line(data = dat2, aes(group = 1, y = present)) + geom_point(data = dat2, aes(y = present)) Note that - ggplot provides no second axis - the boxplots di

Re: [R] Overlaying two graphs using ggplot2 in R

2014-01-27 Thread Duncan Mackay
Hi Kristi Jim has given you 1 non ggplot2 solution here is one from lattice panel.average is a line so added a line for points # convert site to a factor dat1$Site = factor(dat1$Site) datav <- aggregate(Present ~ Site, dat1,mean) datav diff(datav[,2]) # test bw1 <- bwplot(Present~Site,dat

Re: [R] Overlaying two graphs using ggplot2 in R

2014-01-27 Thread David Winsemius
On Jan 27, 2014, at 3:13 AM, Kristi Glover wrote: > Hi R Users, > I was struggling to overlay two graphs created from the two different dataset > using ggplot2. Furthermore, I could not join means of the box plots. > > I tried this way but did not work. Any suggestions? > dat1<-structure(list(s