ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

Interpreter/wrapper for `gpar()`

Open teunbrand opened this issue 2 months ago • 0 comments

This PR aims to fix #5866.

Briefly, a new helper function ggpar() is used to wrap grid::gpar() while applying ggplot's interpretation of graphical parameters.

It simplifies several things:

  • We don't have to protect against 0-length vectors anymore with len0_null().
  • It automatically applies the * .pt modification to lwd.
  • It applies the calculation for point stroke and size via stroke and pointsize arguments.

There are two cases where this isn't used:

  1. When a default argument is an empty gpar().
  2. In sf_grob() which has a mixed interpretations of for example lwd, where in some cases it is linewidth and in other cases it can be stroke.

It is exported but marked as internal function so that extension developers can have access to it as well.

teunbrand avatar Apr 26 '24 08:04 teunbrand