From 63eaf39f8e43fb0f4d2683921ecee0b43b56c0f6 Mon Sep 17 00:00:00 2001 From: Carson Date: Mon, 6 Jan 2020 17:41:32 -0600 Subject: [PATCH 1/3] Remove missing values in ticktext/tickvals As discussed in https://github.com/tidyverse/ggplot2/pull/3566#issuecomment-565085809, it's now possible for the ggplot2 labels/positions to contains missing values, and we should be able to simply ignore them --- R/ggplotly.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/ggplotly.R b/R/ggplotly.R index 55c2060bb0..9c48dae24d 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -686,6 +686,9 @@ gg2list <- function(p, width = NULL, height = NULL, ticktext <- rng[[xy]]$get_labels %()% rng[[paste0(xy, ".labels")]] tickvals <- rng[[xy]]$break_positions %()% rng[[paste0(xy, ".major")]] + ticktext <- ticktext[!is.na(ticktext)] + tickvals <- tickvals[!is.na(tickvals)] + axisObj <- list( # TODO: log type? type = if (isDateType) "date" else if (isDiscreteType) "category" else "linear", From e85ee24394893792b1b39fe3881d73cdc107924f Mon Sep 17 00:00:00 2001 From: Carson Date: Mon, 6 Jan 2020 17:50:16 -0600 Subject: [PATCH 2/3] link to comment --- R/ggplotly.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/ggplotly.R b/R/ggplotly.R index 9c48dae24d..4963b82791 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -686,6 +686,7 @@ gg2list <- function(p, width = NULL, height = NULL, ticktext <- rng[[xy]]$get_labels %()% rng[[paste0(xy, ".labels")]] tickvals <- rng[[xy]]$break_positions %()% rng[[paste0(xy, ".major")]] + # https://github.com/tidyverse/ggplot2/pull/3566#issuecomment-565085809 ticktext <- ticktext[!is.na(ticktext)] tickvals <- tickvals[!is.na(tickvals)] From 9f6fa20746fcaa5d2f3f986b1dcef64708d1eb0c Mon Sep 17 00:00:00 2001 From: Carson Date: Mon, 6 Jan 2020 17:52:59 -0600 Subject: [PATCH 3/3] remove outdated/bad test expectation...the visual baseline covers it --- tests/testthat/test-ggplot-col.R | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/testthat/test-ggplot-col.R b/tests/testthat/test-ggplot-col.R index 0b461308ce..34e3f5fe7d 100644 --- a/tests/testthat/test-ggplot-col.R +++ b/tests/testthat/test-ggplot-col.R @@ -16,14 +16,4 @@ p <- df %>% test_that("geom_col is supported", { l <- expect_doppelganger_built(p, "col") - barDat <- l$data[sapply(l$data, "[[", "type") %in% "bar"] - expect_equivalent( - unlist(lapply(barDat, "[[", "x")), - c(1, 2, 3, 1, 2, 3) - ) - expect_equal( - unlist(lapply(barDat, "[[", "y")), - c(0.7142857, 0.4827586, 0.2, 0.2857143, 0.5172414, 0.8), - tolerance = 0.0001 - ) })