| geom_cnt_text | R Documentation |
Binding for geomtextpath::geom_textsf() and
geomtextpath::geom_labelsf()
geom_cnt_text(
mapping = ggplot2::aes(),
data = NULL,
stat = "sf",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
keep = 0.5,
method = c("voronoi", "straight"),
simplify = TRUE,
...
)
geom_cnt_label(
mapping = ggplot2::aes(),
data = NULL,
stat = "sf",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
keep = 0.5,
method = c("voronoi", "straight"),
simplify = TRUE,
...
)
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. |
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 |
keep |
numeric, proportion of points to retain (0.05-5.0; default 0.5). See Details. |
method |
character, either |
simplify |
logical, if |
... |
Arguments passed on to
|
geom_cnt_text() understands the following aesthetics:
x
y
label
alpha
angle
colour
family
fontface
group
hjust
linecolour
lineheight
linetype
linewidth
size
spacing
textcolour
vjust
In addition to aforementioned aesthetics, geom_cnt_label() also
understands:
boxcolour
boxlinetype
boxlinewidth
fill
geom_cnt(), geomtextpath::geom_textsf(),
geomtextpath::geom_labelsf(), ggplot2::geom_sf()
library(sf)
library(ggplot2)
lake <-
sf::st_read(
system.file("extdata/example.gpkg", package = "centerline"),
layer = "lake",
quiet = TRUE
)
# Plot centerline and lake name as text
ggplot() +
geom_sf(data = lake) +
geom_cnt_text(
data = lake,
aes(label = "Lake Ohau"),
size = 8,
simplify = TRUE
) +
theme_void()
# Plot lake name as label
ggplot() +
geom_sf(data = lake) +
geom_cnt_label(
data = lake,
aes(label = "Lake Ohau"),
linecolor = NA, # disable line drawing
size = 10,
method = "s",
simplify = TRUE
) +
theme_void()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.