Skip to content

Commit

Permalink
Respect sf's plot12 graticule attribute when building axis ticks, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Dec 26, 2019
1 parent 9bcf90a commit c037c68
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/ggplotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,13 @@ gg2list <- function(p, width = NULL, height = NULL,
if ("CoordSf" %in% class(p$coordinates)) {
# see CoordSf$render_axis_v
direction <- if (xy == "x") "E" else "N"
idx <- rng$graticule$type == direction & !is.na(rng$graticule$degree_label)
idx <- rng$graticule$type == direction &
!is.na(rng$graticule$degree_label) &
# Respect the logical 'plot12' column which sf constructs for
# determining which tick labels should be drawn
# https://github.com/r-spatial/sf/blob/b49d37/R/graticule.R#L199
# https://github.com/r-spatial/sf/blob/52a8351/R/plot.R#L580
(rng$graticule$plot12 %||% TRUE)
tickData <- rng$graticule[idx, ]
# TODO: how to convert a language object to unicode character string?
rng[[paste0(xy, ".labels")]] <- sub(
Expand Down

0 comments on commit c037c68

Please sign in to comment.