rstudio / thematic

Theme ggplot2, lattice, and base graphics based on a few simple settings.
https://rstudio.github.io/thematic/
Other
244 stars 10 forks source link

Can't set fill and colour on geom_sf when thematic is on #129

Closed PaulC91 closed 1 year ago

PaulC91 commented 1 year ago

Hi, I noticed manually set fill and colour properties on a geom_sf are ignored when thematic is turned on.

Is there any way to override this behaviour?

Thanks.

library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.2, PROJ 8.2.1; sf_use_s2() is TRUE
library(ggplot2)
library(thematic)

nc <- st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)

# without thematic
ggplot(nc) + geom_sf(fill = "red", colour = "white")


# with thematic
thematic_on(bg = "grey20", fg = "white", accent = "blue")  
ggplot(nc) + geom_sf(fill = "red", colour = "white")

Created on 2022-12-13 with reprex v2.0.2

Session info ``` r sessionInfo() #> R version 4.2.1 (2022-06-23) #> Platform: x86_64-apple-darwin17.0 (64-bit) #> Running under: macOS Big Sur ... 10.16 #> #> Matrix products: default #> BLAS: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib #> LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib #> #> locale: #> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] thematic_0.1.2.9000 ggplot2_3.4.0 sf_1.0-9 #> #> loaded via a namespace (and not attached): #> [1] Rcpp_1.0.9 lattice_0.20-45 sysfonts_0.8.8 class_7.3-20 #> [5] assertthat_0.2.1 digest_0.6.29 utf8_1.2.2 mime_0.12 #> [9] R6_2.5.1 reprex_2.0.2 evaluate_0.16 e1071_1.7-11 #> [13] httr_1.4.4 highr_0.9 pillar_1.8.1 rlang_1.0.6 #> [17] curl_4.3.2 rstudioapi_0.13 jquerylib_0.1.4 R.utils_2.12.0 #> [21] R.oo_1.25.0 rmarkdown_2.15 styler_1.7.0 textshaping_0.3.6 #> [25] stringr_1.4.1 munsell_0.5.0 proxy_0.4-27 compiler_4.2.1 #> [29] xfun_0.32 pkgconfig_2.0.3 systemfonts_1.0.4 htmltools_0.5.3 #> [33] tidyselect_1.1.2 tibble_3.1.8 fansi_1.0.3 showtextdb_3.0 #> [37] dplyr_1.0.9 withr_2.5.0 R.methodsS3_1.8.2 grid_4.2.1 #> [41] jsonlite_1.8.0 gtable_0.3.0 lifecycle_1.0.3 DBI_1.1.3 #> [45] magrittr_2.0.3 units_0.8-0 scales_1.2.1 KernSmooth_2.23-20 #> [49] cli_3.4.1 stringi_1.7.8 cachem_1.0.6 farver_2.1.1 #> [53] fs_1.5.2 xml2_1.3.3 bslib_0.4.1 ragg_1.2.4 #> [57] generics_0.1.3 vctrs_0.5.1 tools_4.2.1 showtext_0.9-5 #> [61] R.cache_0.16.0 glue_1.6.2 purrr_0.3.4 fastmap_1.1.0 #> [65] yaml_2.3.5 colorspace_2.0-3 classInt_0.4-7 knitr_1.39 #> [69] sass_0.4.2 ```