Reproducible example:
set.seed(123)
x <- sample(1:30,9)
y <- sample(1:30,9)
points <- data.frame(x, y,
distance = sample(c("apples","pears","banana"), 9, replace = T))
# Plot
ggplot(points) +
geom_voronoi(aes(x=x,y=y,fill=distance)) +
stat_voronoi(aes(x=x,y=y),geom = "path") +
geom_point(aes(x=x,y=y))
makes:
I wonder if I can limit size of the Voronoi cell, to have a maximum distance from the x,y it is using to plot. I knocked this up in paint:
Some may call that art.
Where the cells can only be so big if they do not intersect with neighboring cells. Any ideas.
Why? I am using GPS data to create cells, then coloring these by a factor. The GPS coordinates are not consistent spatially and I do not want to give the reader false impression. In my real data some of the cells are rather large.