Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion R/geom-ribbon.r
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down