trevorld / ggpattern

ggplot geoms with pattern fills
https://trevorldavis.com/R/ggpattern/dev/
Other
356 stars 18 forks source link

refactor: Use `linewidth` aesthetic for border line widths #84

Closed trevorld closed 1 year ago

trevorld commented 2 years ago

closes #82

trevorld commented 2 years ago

geom_sf_pattern() and geom_boxplot_pattern() are only two geoms of ours that uses size aesthetic to adjust size of points.

library(ggpattern)
ns <- asNamespace("ggpattern")
geoms_names <- ls(ns, pattern = "Geom.*")
geoms <- lapply(geoms_names, \(x) get(x, ns))

idx <- vapply(geoms, \(x) {
  all(c("linewidth", "size") %in% x$aesthetics())
}, logical(1L))

geoms_names[idx]
[1] "GeomBoxplotPattern" "GeomSfPattern" 

All {ggpattern} Geoms now have rename_size = TRUE:


```r
idx <- vapply(geoms, \(x) {
  x$rename_size }
, logical(1))

geoms_names[idx] # same as `geoms_names`
 [1] "GeomAreaPattern"     "GeomBarPattern"      "GeomBoxplotPattern" 
 [4] "GeomColPattern"      "GeomCrossbarPattern" "GeomDensityPattern" 
 [7] "GeomMapPattern"      "GeomPolygonPattern"  "GeomRectPattern"    
[10] "GeomRibbonPattern"   "GeomSfPattern"       "GeomTilePattern"    
[13] "GeomViolinPattern"  
trevorld commented 1 year ago

{ggplot2} v3.4.0 has finally hit CRAN