From 17179fe5acd359b8a770aee9bb12464e9ddaf486 Mon Sep 17 00:00:00 2001 From: Teun van den Brand <49372158+teunbrand@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:45:10 +0200 Subject: [PATCH 1/2] Expose `geom_dotplot()`'s 'weight' aesthetic --- R/geom-dotplot.R | 3 ++- R/stat-bindot.R | 4 +++- man/geom_dotplot.Rd | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/geom-dotplot.R b/R/geom-dotplot.R index 7da03a68dd..802a717c28 100644 --- a/R/geom-dotplot.R +++ b/R/geom-dotplot.R @@ -188,7 +188,8 @@ GeomDotplot <- ggproto("GeomDotplot", Geom, required_aes = c("x", "y"), non_missing_aes = c("size", "shape"), - default_aes = aes(colour = "black", fill = "black", alpha = NA, stroke = 1, linetype = "solid"), + default_aes = aes(colour = "black", fill = "black", alpha = NA, + stroke = 1, linetype = "solid", weight = 1), setup_data = function(data, params) { data$width <- data$width %||% diff --git a/R/stat-bindot.R b/R/stat-bindot.R index 73272f2fc4..128a5a6a47 100644 --- a/R/stat-bindot.R +++ b/R/stat-bindot.R @@ -124,7 +124,9 @@ StatBindot <- ggproto("StatBindot", Stat, data$x <- midline } return(data) - } + }, + + dropped_aes = "weight" ) diff --git a/man/geom_dotplot.Rd b/man/geom_dotplot.Rd index f432959c9b..3a3481006a 100644 --- a/man/geom_dotplot.Rd +++ b/man/geom_dotplot.Rd @@ -137,6 +137,7 @@ to match the number of dots. \item \code{\link[=aes_group_order]{group}} \item \code{\link[=aes_linetype_size_shape]{linetype}} \item \code{stroke} +\item \code{weight} } Learn more about setting these aesthetics in \code{vignette("ggplot2-specs")}. } From ae65b89a7f86816aa7de71eaf0ee99aaf3b954ea Mon Sep 17 00:00:00 2001 From: Teun van den Brand <49372158+teunbrand@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:50:03 +0200 Subject: [PATCH 2/2] `stat_ydensity()` drops weight --- R/stat-ydensity.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/stat-ydensity.R b/R/stat-ydensity.R index 5733751ebe..9cfca40e8b 100644 --- a/R/stat-ydensity.R +++ b/R/stat-ydensity.R @@ -138,8 +138,9 @@ StatYdensity <- ggproto("StatYdensity", Stat, ) data$flipped_aes <- flipped_aes flip_data(data, flipped_aes) - } + }, + dropped_aes = "weight" ) calc_bw <- function(x, bw) {