Skip to content

Commit 4226314

Browse files
committed
Refactor
1 parent 66fb4d8 commit 4226314

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

R/ggplotly.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,9 @@ gg2list <- function(p, width = NULL, height = NULL,
668668
"\\*\\s+degree[ ]?[\\*]?", "&#176;",
669669
gsub("\"", "", tickData[["degree_label"]])
670670
)
671-
# Downstream logic expects the 'break positions' to be on 0-1 scale
671+
# Downstream logic expects these 'break positions' to be on 0-1 scale
672672
# (which is then rescaled back to the data scale)
673-
rng[[paste0(xy, ".major")]] <- scales::rescale(
674-
tickData[[paste0(xy, "_start")]]
675-
)
673+
rng[[paste0(xy, ".major")]] <- scales::rescale(tickData[[paste0(xy, "_start")]])
676674

677675
# If it doesn't already exist (for this panel),
678676
# generate graticule (as done in, CoordSf$render_bg)
@@ -787,9 +785,11 @@ gg2list <- function(p, width = NULL, height = NULL,
787785
# set scaleanchor/scaleratio if these are fixed coordinates
788786
# the logic here is similar to what p$coordinates$aspect() does,
789787
# but the ratio is scaled to the data range by plotly.js
790-
fixed_coords <- c("CoordSf", "CoordFixed", "CoordMap", "CoordQuickmap")
791-
is_fixed <- isFALSE(p$coordinates$is_free())
792-
if (inherits(p$coordinates, fixed_coords) || is_fixed) {
788+
is_fixed <- inherits(
789+
p$coordinates,
790+
c("CoordSf", "CoordFixed", "CoordMap", "CoordQuickmap")
791+
)
792+
if (is_fixed || isFALSE(p$coordinates$is_free())) {
793793
axisObj$scaleanchor <- anchor
794794
ratio <- p$coordinates$ratio %||% 1
795795
axisObj$scaleratio <- if (xy == "y") ratio else 1 / ratio

0 commit comments

Comments
 (0)