'how to control the width of ggpattern's fill pattern
I want to decrease the width of ggpattern's fill pattern, making it looks like a black oblique line. However, my script did not work.
library(ggplot2)
library(ggpattern)
ggplot(sf_poly) +
geom_sf_pattern(pattern_fill = "transparent", fill = "transparent",
# pattern = 0,
pattern_size = 0.2,
pattern_type = 3,
color = "transparent",
size = 0.2)
Solution 1:[1]
According to the packages "stripe" vignette you can use the pattern_density aesthetic to control the area the pattern fills i.e. in this case a lower pattern_density value will decrease the width of the stripes. Alternatively decreasing pattern_spacing will increase the number of stripes which would also reduce the stripe width for a fixed pattern_density value (more stripes filling a given area means each stripe must be smaller).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Trevor |

