element_geom use of linewidth & borderwidth etc

#6512

Issue Details

about 2 months ago
No assignee
davidhodge931davidhodge931
opened about 2 months ago
Author

Looking at element_geom, I noticed a couple of things:

  1. linewidth/linetype and borderwidth/borderwidth doesn't seem internally consistent.. See example code below. Not sure how to fix this..
  2. Likewise, I think it'd be more intuitive if argument names in element_geom names would map to aesthethetics as much as possible. So I think pointsize sould instead be size etc with a separate element_geom_font function.
library(tidyverse) p <- ggplot(economics, aes(date)) + geom_density() #would expect this to work ggplot(economics, aes(date)) + geom_density() + theme( geom.density = element_geom( linewidth = 5, linetype = 3 ) )

#given you can do this ggplot(economics, aes(date)) + geom_density( linewidth = 5, linetype = 3 )

#instead have to do this ggplot(economics, aes(date)) + geom_density() + theme( geom.density = element_geom( borderwidth = 5, bordertype = 3 ) )

#but you can't do this ggplot(economics, aes(date)) + geom_density( borderwidth = 5, bordertype = 3 ) #> Warning in geom_density(borderwidth = 5, bordertype = 3): Ignoring unknown #> parameters: `borderwidth` and `bordertype`

Created on 2025-06-17 with reprex v2.1.1