Skip to content

Commit c47c1f9

Browse files
authored
Merge pull request #1679 from ropensci/ggplotly-missing-ticks
Remove missing values in ticktext/tickvals
2 parents 669db9c + 9f6fa20 commit c47c1f9

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

R/ggplotly.R

+4
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,10 @@ gg2list <- function(p, width = NULL, height = NULL,
686686
ticktext <- rng[[xy]]$get_labels %()% rng[[paste0(xy, ".labels")]]
687687
tickvals <- rng[[xy]]$break_positions %()% rng[[paste0(xy, ".major")]]
688688

689+
# https://github.com/tidyverse/ggplot2/pull/3566#issuecomment-565085809
690+
ticktext <- ticktext[!is.na(ticktext)]
691+
tickvals <- tickvals[!is.na(tickvals)]
692+
689693
axisObj <- list(
690694
# TODO: log type?
691695
type = if (isDateType) "date" else if (isDiscreteType) "category" else "linear",

tests/testthat/test-ggplot-col.R

-10
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,4 @@ p <- df %>%
1616

1717
test_that("geom_col is supported", {
1818
l <- expect_doppelganger_built(p, "col")
19-
barDat <- l$data[sapply(l$data, "[[", "type") %in% "bar"]
20-
expect_equivalent(
21-
unlist(lapply(barDat, "[[", "x")),
22-
c(1, 2, 3, 1, 2, 3)
23-
)
24-
expect_equal(
25-
unlist(lapply(barDat, "[[", "y")),
26-
c(0.7142857, 0.4827586, 0.2, 0.2857143, 0.5172414, 0.8),
27-
tolerance = 0.0001
28-
)
2919
})

0 commit comments

Comments
 (0)