tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.4k stars 2k forks source link

Standardising calls to `gpar()` #5866

Closed teunbrand closed 2 months ago

teunbrand commented 2 months ago

Throughout ggplot2's codebase, there are various calls to grid::gpar(). There are several operations that happen almost ubiquitously, like the following gpar(lwd = len0_null(linewidth * .pt)). The suggestion here is to write a wrapper for grid::gpar() that automatically applies such adjustments and ensures the absence of 0-length vectors, which I believe would result in cleaner code.