Skip to content

Commit 633e350

Browse files
authored
geom_function(): x-axis title produced automatically where no data is added (#6047)
1 parent ee5c9e5 commit 633e350

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ggplot2 (development version)
22

3+
* Fixed bug in `stat_function()` so x-axis title now produced automatically
4+
when no data added. (@phispu, #5647).
35
* geom_sf now accepts shape names (@sierrajohnson, #5808)
46
* Added `gg` class to `labs()` (@phispu, #5553).
57
* Missing values from discrete palettes are no longer translated

R/stat-function.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ stat_function <- function(mapping = NULL, data = NULL,
5050
#' @usage NULL
5151
#' @export
5252
StatFunction <- ggproto("StatFunction", Stat,
53-
default_aes = aes(y = after_scale(y)),
53+
default_aes = aes(x = NULL, y = after_scale(y)),
5454

5555
compute_group = function(data, scales, fun, xlim = NULL, n = 101, args = list()) {
5656
if (is.null(scales$x)) {

0 commit comments

Comments
 (0)