Skip to content

Commit 6cc7370

Browse files
committed
fix sf graticule styling
1 parent 93136e8 commit 6cc7370

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

R/ggplotly.R

+1-5
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,7 @@ gg2list <- function(p, width = NULL, height = NULL,
622622
d <- expand(rng$graticule)
623623
d$x <- scales::rescale(d$x, rng$x_range, from = c(0, 1))
624624
d$y <- scales::rescale(d$y, rng$y_range, from = c(0, 1))
625-
params <- list(
626-
colour = theme$panel.grid.major$colour,
627-
size = theme$panel.grid.major$size,
628-
linetype = theme$panel.grid.major$linetype
629-
)
625+
params <- with(panelGrid, list(colour = colour, size = size, linetype = linetype))
630626
grill <- geom2trace.GeomPath(d, params)
631627
grill$hoverinfo <- "none"
632628
grill$showlegend <- FALSE

tests/testthat/test-ggplot-sf.R

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ test_that("geom_sf() polygons with fill/text.", {
3333
expect_true(
3434
all(unlist(lapply(l$data, "[[", "hoverinfo")) %in% c("none", "text"))
3535
)
36-
unlist(lapply(l$data, "[[", "text"))
36+
# graticule styling should inherit from panel.grid.major
37+
expect_equivalent(
38+
l$data[[1]]$line$color,
39+
toRGB(ggplot2::calc_element("panel.grid.major", ggplot2::theme_gray())[["colour"]])
40+
)
3741
})
3842

3943

0 commit comments

Comments
 (0)