Skip to content

Commit f58d4ba

Browse files
Closes plotly#2031. ggplot internaly convert color to colour
1 parent 6186822 commit f58d4ba

File tree

329 files changed

+10
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

329 files changed

+10
-328
lines changed

R/ggplotly.R

+10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ ggplotly.ggmatrix <- function(p = ggplot2::last_plot(), width = NULL,
8888
height = NULL, tooltip = "all", dynamicTicks = FALSE,
8989
layerData = 1, originalData = TRUE, source = "A", ...) {
9090
dots <- list(...)
91+
# rectify tooltips, ggplot automatically convert `color` => `colour`
92+
tooltip <- rectify_tooltips(tooltip)
93+
9194
# provide a sensible crosstalk if none is already provided (makes ggnostic() work at least)
9295
if (!crosstalk_key() %in% names(p$data)) {
9396
p$data[[crosstalk_key()]] <- p$data[[".rownames"]] %||% seq_len(nrow(p$data))
@@ -145,6 +148,8 @@ ggplotly.ggmatrix <- function(p = ggplot2::last_plot(), width = NULL,
145148
ggplotly.ggplot <- function(p = ggplot2::last_plot(), width = NULL,
146149
height = NULL, tooltip = "all", dynamicTicks = FALSE,
147150
layerData = 1, originalData = TRUE, source = "A", ...) {
151+
# rectify tooltips, ggplot automatically convert `color` => `colour`
152+
tooltip <- rectify_tooltips(tooltip)
148153
l <- gg2list(p, width = width, height = height, tooltip = tooltip,
149154
dynamicTicks = dynamicTicks, layerData = layerData,
150155
originalData = originalData, source = source, ...)
@@ -1433,3 +1438,8 @@ getAesMap <- function(plot, layer) {
14331438
layer$mapping
14341439
}
14351440
}
1441+
1442+
rectify_tooltips <- function(tooltip){
1443+
tooltip[tooltip == "color"] <- "colour"
1444+
tooltip
1445+
}

tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor-major.svg

-1
This file was deleted.

tests/testthat/_snaps/cookbook-axes/cookbook-axes-blank-minor.svg

-1
This file was deleted.

0 commit comments

Comments
 (0)