In R, Lets say that I have a set of x and y points, how can I get a geom_polygon
to encapsulate all points, ie, what is the best way to create a 'bounding' polygon for the set?
library(ggplot2)
set.seed(1)
x <- runif(100)
y <- runif(100)
mydata <- data.frame(x,y)
ggplot(mydata,aes(x,y)) + geom_point() + geom_polygon()
The above code is pretty clear that the result is unsatisfactory (result below).