4

I want to know if it is possible to know the percentage of overlap between convex hulls? For example, what is the % overlap between species Versicolor and Virginica?

The code I used for the plot:

library(ggplot2)
library(plyr)
iris
find_hull <- function(iris) iris[chull(iris$Sepal.Length, iris$Sepal.Width), ]
hulls <- ddply(iris, "Species", find_hull)
plot<-ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width, colour=Species, fill = Species)) +geom_point() +geom_polygon(data = hulls, alpha = 0.5) 
plot

The result: enter image description here

Bonnie
  • 61
  • 2
  • 2
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Feb 15 '22 at 06:20
  • Got it. I have edited the question. – Bonnie Feb 15 '22 at 08:11
  • 1
    There is `gIntersects` from the `rgeos` package – danlooo Feb 15 '22 at 10:39

0 Answers0