hatchedLayer | R Documentation |
Plot a hatched layer with several different patterns. Suitable for b/w print maps.
hatchedLayer(x, pattern = "dot", density = 1, txt = "a", ...)
x |
an sf object, a simple feature collection. It should be either a
|
pattern |
Desired pattern to use for hatching. Possible values are:
|
density |
of the grid. By default the function uses a grid with a
minimum of 10 cells on the shortest dimension of the bounding box.
Additionally, it is possible to pass a
|
txt |
for the |
... |
Additional graphic parameters (see Details). |
Possible values are:
pattern | add | col | bg | cex | pch | lwd | lty |
"dot" | x | x | x | x | x | ||
"text" | x | x | x | ||||
Lines patterns | x | x | x | x |
When passing mode='sfc'
an 'sf' object (either MULTLINESTRING
or MULTIPOINT) is returned.
dieghernan, https://github.com/dieghernan/
legendHatched
library(sf)
mtq <- st_read(system.file("gpkg/mtq.gpkg", package = "cartography"))
par(mar=c(1,1,1,1))
hatchedLayer(mtq, "dot")
title("dot")
plot(st_geometry(mtq), border = NA, col="grey80")
hatchedLayer(mtq, "text", txt = "Y", add=TRUE)
title("text")
hatchedLayer(mtq, "diamond", density = 0.5)
plot(st_union(st_geometry(mtq)), add = TRUE)
title("diamond")
hatchedLayer(mtq, "grid", lwd = 1.5)
title("grid")
hatchedLayer(mtq, "hexagon", col = "blue")
title("hexagon")
hatchedLayer(mtq, "horizontal", lty = 5)
title("horizontal")
hatchedLayer(mtq, "vertical")
title("vertical")
hatchedLayer(mtq, "left2right")
title("left2right")
hatchedLayer(mtq, "right2left")
title("right2left")
hatchedLayer(mtq, "zigzag",cellsize=5000)
title("zigzag")
hatchedLayer(mtq, "circle")
title("circle")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.