devoutsvg
devoutsvg copied to clipboard
Default Specifications (Bugs)
Hey @coolbutuseless
Found two bugs for you:
First here's the code to reproduce:
library(ggplot2)
library(svgpatternsimple)
library(devout)
library(sf)
# load test data
stl <- st_read('https://bransonf.com/data/stl.geojson')
stl[grep('Park', stl$neighborhood), 'fill'] <- 1
stl[grep('Park', stl$neighborhood, invert = TRUE), 'fill'] <- 0
# define patterns
pattern0 <- svgpatternsimple::encode_pattern_params_as_hex_colour(
pattern_name = 'null'
)
pattern1 <- svgpatternsimple::encode_pattern_params_as_hex_colour(
pattern_name = 'hex',
spacing = .5,
colour = '#2606B8',
fill = '#C21919'
)
# open an SVG graphics device
svgout(filename = "gmap.svg", pattern_pkg = 'svgpatternsimple')
# make a ggplot
ggplot() +
geom_sf(aes(fill = as.factor(fill)),
data = stl) +
scale_fill_manual(
values = c(
'0' = pattern0,
'1' = pattern1
)
)
# close graphics device
invisible(dev.off())
And the output:
The hexagon pattern should be blue, but it is instead inheriting the default defined in this line
As far as the reason the pink squares are defaulting for the ggplot background, I haven't traced this.
Thanks for the bug report. I hope to get back to this soon.