From ecb5edf2952cb5b331e0ae939482dad39f0ca1c0 Mon Sep 17 00:00:00 2001 From: Carson Date: Fri, 4 Nov 2022 17:24:17 -0500 Subject: [PATCH] Account for the fact that linewidth_or_size() could take non element/Geom input (like NULL) --- NAMESPACE | 1 + R/layers2traces.R | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index ec1fd23ced..9fe5f8e0d5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -27,6 +27,7 @@ S3method(layout,matrix) S3method(layout,plotly) S3method(layout,shiny.tag.list) S3method(linewidth_or_size,Geom) +S3method(linewidth_or_size,default) S3method(linewidth_or_size,element) S3method(plotly_build,"NULL") S3method(plotly_build,gg) diff --git a/R/layers2traces.R b/R/layers2traces.R index 124d2fd595..dedd8d9d43 100644 --- a/R/layers2traces.R +++ b/R/layers2traces.R @@ -1136,6 +1136,11 @@ linewidth_or_size.element <- function(x) { if ("linewidth" %in% names(x)) "linewidth" else "size" } +#' @export +linewidth_or_size.default <- function(x) { + if (get_package_version("ggplot2") >= "3.4") "linewidth" else "size" +} + # Convert R pch point codes to plotly "symbol" codes. pch2symbol <- function(x) {