Skip to content

Commit c037c68

Browse files
committed
Respect sf's plot12 graticule attribute when building axis ticks, fixes #1673
1 parent 9bcf90a commit c037c68

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

R/ggplotly.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,13 @@ gg2list <- function(p, width = NULL, height = NULL,
612612
if ("CoordSf" %in% class(p$coordinates)) {
613613
# see CoordSf$render_axis_v
614614
direction <- if (xy == "x") "E" else "N"
615-
idx <- rng$graticule$type == direction & !is.na(rng$graticule$degree_label)
615+
idx <- rng$graticule$type == direction &
616+
!is.na(rng$graticule$degree_label) &
617+
# Respect the logical 'plot12' column which sf constructs for
618+
# determining which tick labels should be drawn
619+
# https://github.com/r-spatial/sf/blob/b49d37/R/graticule.R#L199
620+
# https://github.com/r-spatial/sf/blob/52a8351/R/plot.R#L580
621+
(rng$graticule$plot12 %||% TRUE)
616622
tickData <- rng$graticule[idx, ]
617623
# TODO: how to convert a language object to unicode character string?
618624
rng[[paste0(xy, ".labels")]] <- sub(

0 commit comments

Comments
 (0)