diff --git a/R/plot.R b/R/plot.R index 3eacdf78..7c3c7eaf 100644 --- a/R/plot.R +++ b/R/plot.R @@ -318,9 +318,13 @@ build_fbl_layer <- function(object, data = NULL, level = c(80, 95), } # Apply ramped fill if (!is.null(data[["fill_ramp"]])) { - data$fill = mapply(function(color, amount){ - (scales::seq_gradient_pal(attr(amount, "from") %||% "white", color))(amount %||% NA) - }, data$fill, data$fill_ramp) + if (utils::packageVersion("ggdist") > "3.3.1") { + data$fill <- ggdist::ramp_colours(data$fill, data$fill_ramp) + } else { + data$fill <- mapply(function(color, amount){ + (scales::seq_gradient_pal(attr(amount, "from") %||% "white", color))(amount %||% NA) + }, data$fill, data$fill_ramp) + } } ggplot2::draw_key_rect(data, params, size) }