ggplot2
ggplot2 copied to clipboard
Interpreter/wrapper for `gpar()`
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 tolwd
. - It applies the calculation for point
stroke
andsize
viastroke
andpointsize
arguments.
There are two cases where this isn't used:
- When a default argument is an empty
gpar()
. - In
sf_grob()
which has a mixed interpretations of for examplelwd
, where in some cases it islinewidth
and in other cases it can bestroke
.
It is exported but marked as internal function so that extension developers can have access to it as well.