From 1f0c296ba1170cf9de446a3e554565ff04338cc8 Mon Sep 17 00:00:00 2001 From: phispu Date: Thu, 15 Aug 2024 14:41:54 -0700 Subject: [PATCH 1/4] Produces x-axis title automatically when no data added. Fixes #5647. --- R/stat-function.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/stat-function.R b/R/stat-function.R index 8f31b8daba..bf6d2e4b74 100644 --- a/R/stat-function.R +++ b/R/stat-function.R @@ -50,7 +50,7 @@ stat_function <- function(mapping = NULL, data = NULL, #' @usage NULL #' @export StatFunction <- ggproto("StatFunction", Stat, - default_aes = aes(y = after_scale(y)), + default_aes = aes(x = NULL, y = after_scale(y)), compute_group = function(data, scales, fun, xlim = NULL, n = 101, args = list()) { if (is.null(scales$x)) { From 6f0a01be95551bef37158a8463344f9c35e09798 Mon Sep 17 00:00:00 2001 From: phispu Date: Thu, 15 Aug 2024 14:57:06 -0700 Subject: [PATCH 2/4] Produces x-axis title automatically when no data added. Fixes #5647. --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 4c0ea1e891..697b1a74c0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # ggplot2 (development version) +* Produces x-axis title automatically when no data added. + (@phispu, #5647). * Missing values from discrete palettes are no longer translated (@teunbrand, #5929). * Fixed bug in `facet_grid(margins = TRUE)` when using expresssions From 950077105f296c1d182d329977068d36501faa8a Mon Sep 17 00:00:00 2001 From: phispu Date: Thu, 15 Aug 2024 14:58:16 -0700 Subject: [PATCH 3/4] Produces x-axis title automatically when no data added. Fixes #5647. --- NEWS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 697b1a74c0..5753d6b5dd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # ggplot2 (development version) -* Produces x-axis title automatically when no data added. +* Fixed bug in `geom_smooth()` so x-axis title now produced automatically + when no data added. (@phispu, #5647). * Missing values from discrete palettes are no longer translated (@teunbrand, #5929). From 0b5fb1f9e3d49ca584e260efd7a48b83324b4419 Mon Sep 17 00:00:00 2001 From: phispu Date: Thu, 15 Aug 2024 15:12:31 -0700 Subject: [PATCH 4/4] Updated news to reflect bug fix from geom_smooth() to stat_function(). --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 5753d6b5dd..4549151ac6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # ggplot2 (development version) -* Fixed bug in `geom_smooth()` so x-axis title now produced automatically +* Fixed bug in `stat_function()` so x-axis title now produced automatically when no data added. (@phispu, #5647). * Missing values from discrete palettes are no longer translated