st_hatched_polygon: st_hatched_polygon

View source: R/st_hatched_polygon.R

st_hatched_polygonR Documentation

st_hatched_polygon

Description

st_hatched_polygon

Usage

st_hatched_polygon(x, density = 2, angle = 45, fillOddEven = FALSE)

Arguments

x

sf polygon object

density

the density of shading lines, in lines per inch. The default value of NULL means that no shading lines are drawn. A zero value of density means no shading nor filling whereas negative values and NA suppress shading (and so allow color filling).

angle

the slope of shading lines, given as an angle in degrees (counter-clockwise).

fillOddEven

logical controlling the polygon shading mode: see below for details. Default FALSE.

Value

An hatched area, sf lines

References

  1. https://github.com/statnmap/HatchedPolygons

  2. https://statnmap.github.io/HatchedPolygons/

  3. https://statnmap.github.io/HatchedPolygons/articles/leaflet_shading_polygon.html

Examples

library(gg.layers)
library(ggplot2)
data("d_trendPerc")

d = d_trendPerc %>% subset(perc >= 0.99) %>% .[, 1:2]
poly = st_point2poly(d)
hatches = st_hatched_polygon(poly) #
ggplot(hatches) + geom_sf()

rpkgs/gg.layers documentation built on Sept. 14, 2024, 11:07 p.m.