From ab78539dd16a9da349b7772812451824176e945e Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Thu, 11 Apr 2019 20:18:21 +0200 Subject: [PATCH 1/2] fix problems during ribbon data sort --- R/geom-ribbon.r | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/geom-ribbon.r b/R/geom-ribbon.r index 2735fae254..258833c549 100644 --- a/R/geom-ribbon.r +++ b/R/geom-ribbon.r @@ -63,7 +63,12 @@ GeomRibbon <- ggproto("GeomRibbon", Geom, required_aes = c("x", "ymin", "ymax"), setup_data = function(data, params) { - transform(data[order(data$PANEL, data$group, data$x), ], y = ymin) + if (is.null(data$ymin) && is.null(data$ymax)) { + stop("Either ymin or ymax must be given as an aesthetic", call. = FALSE) + } + data <- data[order(data$PANEL, data$group, data$x), , drop = FALSE] + data$y <- data$ymin %||% data$ymax + data }, draw_key = draw_key_polygon, From e339764837b568f9ffd43bc1878540e32fadd54b Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Tue, 30 Apr 2019 09:35:12 +0200 Subject: [PATCH 2/2] Update R/geom-ribbon.r --- R/geom-ribbon.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/geom-ribbon.r b/R/geom-ribbon.r index 258833c549..fb292cb0fa 100644 --- a/R/geom-ribbon.r +++ b/R/geom-ribbon.r @@ -64,7 +64,7 @@ GeomRibbon <- ggproto("GeomRibbon", Geom, setup_data = function(data, params) { if (is.null(data$ymin) && is.null(data$ymax)) { - stop("Either ymin or ymax must be given as an aesthetic", call. = FALSE) + stop("Either ymin or ymax must be given as an aesthetic.", call. = FALSE) } data <- data[order(data$PANEL, data$group, data$x), , drop = FALSE] data$y <- data$ymin %||% data$ymax