From 13a66842f842f273c1576000632ddfa65142bc65 Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Wed, 4 Jun 2025 10:50:53 +0200 Subject: [PATCH 1/3] adapt to ggplot2/#6450 --- R/ggplotly.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/ggplotly.R b/R/ggplotly.R index e358bce17a..beb0e52a07 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -784,7 +784,8 @@ gg2list <- function(p, width = NULL, height = NULL, # the logic here is similar to what p$coordinates$aspect() does, # but the ratio is scaled to the data range by plotly.js fixed_coords <- c("CoordSf", "CoordFixed", "CoordMap", "CoordQuickmap") - if (inherits(p$coordinates, fixed_coords)) { + is_fixed <- !is.null(p$coordinates$is_free()) + if (inherits(p$coordinates, fixed_coords) || is_fixed) { axisObj$scaleanchor <- anchor ratio <- p$coordinates$ratio %||% 1 axisObj$scaleratio <- if (xy == "y") ratio else 1 / ratio From 978d5a25418471c2234ec6ebec1625a3f658badf Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Wed, 4 Jun 2025 10:52:39 +0200 Subject: [PATCH 2/3] repair invalid usage --- tests/testthat/test-ggplot-labels.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-ggplot-labels.R b/tests/testthat/test-ggplot-labels.R index 4a4a8cfb34..69ca3b4e22 100644 --- a/tests/testthat/test-ggplot-labels.R +++ b/tests/testthat/test-ggplot-labels.R @@ -51,6 +51,6 @@ test_that("empty labels work", { p <- ggplot(palmerpenguins::penguins, aes(bill_length_mm, bill_depth_mm, color = species)) + geom_point() + - labs(x = element_blank(), y = element_blank()) + labs(x = NULL, y = NULL) b <- expect_doppelganger_built(p, "labs-element-blank") }) From 5f8538c208c28774f2efebcda2d1c3e32eef57ee Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Thu, 5 Jun 2025 14:45:02 +0200 Subject: [PATCH 3/3] fix logic mistake --- R/ggplotly.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/ggplotly.R b/R/ggplotly.R index beb0e52a07..7922f4e3f3 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -784,7 +784,7 @@ gg2list <- function(p, width = NULL, height = NULL, # the logic here is similar to what p$coordinates$aspect() does, # but the ratio is scaled to the data range by plotly.js fixed_coords <- c("CoordSf", "CoordFixed", "CoordMap", "CoordQuickmap") - is_fixed <- !is.null(p$coordinates$is_free()) + is_fixed <- isFALSE(p$coordinates$is_free()) if (inherits(p$coordinates, fixed_coords) || is_fixed) { axisObj$scaleanchor <- anchor ratio <- p$coordinates$ratio %||% 1