geom_voronoi | R Documentation |
Convenience function for use with stat_voronoi
.
Uses geom_polygon
as the default geom and stat_voronoi
as the default stat.
To plot region borders instead of a choropleth map, use stat_voronoi
with geom="path"
,
or use fill=NA
with color="black"
.
geom_voronoi(
mapping = NULL,
data = NULL,
stat = StatVoronoi,
position = "identity",
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
outline = NULL
)
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
outline |
|
set.seed(45056)
x <- sample(1:200,100)
y <- sample(1:200,100)
points <- data.frame(x, y,
distance = sqrt((x-100)^2 + (y-100)^2))
circle <- data.frame(x = 100*(1+cos(seq(0, 2*pi, length.out = 2500))),
y = 100*(1+sin(seq(0, 2*pi, length.out = 2500))),
group = rep(1,2500))
ggplot(points) +
geom_voronoi(aes(x=x,y=y,fill=distance))
ggplot(points) +
geom_voronoi(aes(x=x,y=y,fill=distance),outline=circle)
ggplot(points) +
geom_voronoi(aes(x=x,y=y,fill=distance),fill=NA,color="black")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.