We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 06ca577 commit f139f40Copy full SHA for f139f40
NEWS.md
@@ -1,5 +1,8 @@
1
# ggplot2 (development version)
2
3
+* Fixed spurious warnings when the `weight` was used in `stat_bin_2d()`,
4
+ `stat_boxplot()`, `stat_contour()`, `stat_bin_hex()` and `stat_quantile()`
5
+ (@teunbrand, #5216).
6
* Various type checks and their messages have been standardised
7
(@teunbrand, #4834).
8
* The `layer_data()`, `layer_scales()` and `layer_grob()` now have the default
R/stat-bin2d.R
@@ -84,7 +84,9 @@ StatBin2d <- ggproto("StatBin2d", Stat,
84
out$density <- out$count / sum(out$count, na.rm = TRUE)
85
out$ndensity <- out$density / max(out$density, na.rm = TRUE)
86
out
87
- }
+ },
88
+
89
+ dropped_aes = "weight" # No longer available after transformation
90
)
91
92
dual_param <- function(x, default = list(x = NULL, y = NULL)) {
R/stat-binhex.R
@@ -60,6 +60,9 @@ StatBinhex <- ggproto("StatBinhex", Stat,
60
out$value <- NULL
61
62
63
64
65
+ # weight is no longer available after transformation
66
+ dropped_aes = "weight"
67
68
R/stat-boxplot.R
@@ -51,7 +51,7 @@ StatBoxplot <- ggproto("StatBoxplot", Stat,
51
non_missing_aes = "weight",
52
# either the x or y aesthetic will get dropped during
53
# statistical transformation, depending on the orientation
54
- dropped_aes = c("x", "y"),
+ dropped_aes = c("x", "y", "weight"),
55
setup_data = function(self, data, params) {
56
data <- flip_data(data, params$flipped_aes)
57
data$x <- data$x %||% 0
R/stat-contour.R
@@ -90,7 +90,8 @@ StatContour <- ggproto("StatContour", Stat,
required_aes = c("x", "y", "z"),
default_aes = aes(order = after_stat(level)),
93
- dropped_aes = "z", # z gets dropped during statistical transformation
+ # z and weight get dropped during statistical transformation
94
+ dropped_aes = c("z", "weight"),
95
96
setup_params = function(data, params) {
97
params$z.range <- range(data$z, na.rm = TRUE, finite = TRUE)
@@ -120,7 +121,8 @@ StatContourFilled <- ggproto("StatContourFilled", Stat,
120
121
122
123
default_aes = aes(order = after_stat(level), fill = after_stat(level)),
124
125
126
127
128
R/stat-quantilemethods.R
@@ -96,7 +96,10 @@ StatQuantile <- ggproto("StatQuantile", Stat,
method.args = method.args
98
vec_rbind0(!!!result)
99
100
101
102
103
104
105
quant_pred <- function(quantile, data, method, formula, weight, grid,
0 commit comments