search for: find_hull

Displaying 1 result from an estimated 1 matches for "find_hull".

Did you mean: find_all
2013 Jan 28
1
Adding 95% contours around scatterplot points with ggplot2
...iate any assistance. Thanks, Nate x<-c(seq(0.15,0.4,length.out=30),seq(0.2,0.6,length.out=30), seq(0.4,0.6,length.out=30)) y<-c(0.55,x[1:29]+0.2*rnorm(29,0.4,0.3),x[31:60]*rnorm(30,0.3,0.1),x[61:90]*rnorm(30,0.4,0.25)) data<-data.frame(level=c(rep(1, 30),rep(2,30), rep(3,30)), x=x,y=y) find_hull <- function(data) data[chull(data$x, data$y), ] hulls <- ddply(data, .(level), find_hull) fig1 <- ggplot(data=data, aes(x, y, colour=(factor(level)), fill=level))+geom_point() fig1 <- fig1 + geom_polygon(data=hulls, alpha=.2) fig1 [[alternative HTML version deleted]]