Skip to content

Commit be92f44

Browse files
committed
fix axis string substitution. fixes #640
1 parent 6bd3f5b commit be92f44

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/ggplotly.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all", source = "A
212212
}
213213
}
214214
# format the axis/anchor to a format plotly.js respects
215-
panel$layout$xaxis <- paste0("xaxis", sub("1", "", panel$layout$xaxis))
216-
panel$layout$yaxis <- paste0("yaxis", sub("1", "", panel$layout$yaxis))
217-
panel$layout$xanchor <- paste0("y", sub("1", "", panel$layout$xanchor))
218-
panel$layout$yanchor <- paste0("x", sub("1", "", panel$layout$yanchor))
215+
panel$layout$xaxis <- paste0("xaxis", sub("1$", "", panel$layout$xaxis))
216+
panel$layout$yaxis <- paste0("yaxis", sub("1$", "", panel$layout$yaxis))
217+
panel$layout$xanchor <- paste0("y", sub("1$", "", panel$layout$xanchor))
218+
panel$layout$yanchor <- paste0("x", sub("1$", "", panel$layout$yanchor))
219219
# for some layers2traces computations, we need the range of each panel
220220
panel$layout$x_min <- sapply(panel$ranges, function(z) min(z$x.range))
221221
panel$layout$x_max <- sapply(panel$ranges, function(z) max(z$x.range))

0 commit comments

Comments
 (0)