View source: R/stat_spat_coordinates.R
stat_spat_coordinates | R Documentation |
SpatVector
objectsstat_spat_coordinates()
extracts the coordinates from SpatVector
objects
and summarises them to one pair of coordinates (x and y) per geometry.
stat_spat_coordinates(
mapping = aes(),
data = NULL,
geom = "point",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
mapping |
Set of aesthetic mappings created by |
data |
A |
geom |
The geometric object to use to display the data for this layer.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
You can also set this to one of "polygon", "line", and "point" to override the default legend. |
inherit.aes |
If |
... |
Other arguments passed on to |
Wrapper of ggplot2::stat_sf_coordinates()
.
See ggplot2::stat_sf_coordinates()
for details.
A ggplot2 layer
Other ggplot2 utils:
autoplot.Spat
,
fortify.Spat
,
geom_spat_contour
,
geom_spatraster()
,
geom_spatraster_rgb()
,
ggspatvector
cyl <- terra::vect(system.file("extdata/cyl.gpkg", package = "tidyterra"))
library(ggplot2)
ggplot(cyl) +
stat_spat_coordinates()
ggplot(cyl) +
geom_errorbarh(
aes(
geometry = geometry,
xmin = after_stat(x) - 50000,
xmax = after_stat(x) + 50000,
y = after_stat(y),
height = 10000
),
stat = "sf_coordinates"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.