Skip to content

Commit 1a02fe9

Browse files
Conformed with carson's review
1 parent f58d4ba commit 1a02fe9

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

R/ggplotly.R

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ 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)
9391

9492
# provide a sensible crosstalk if none is already provided (makes ggnostic() work at least)
9593
if (!crosstalk_key() %in% names(p$data)) {
@@ -148,8 +146,6 @@ ggplotly.ggmatrix <- function(p = ggplot2::last_plot(), width = NULL,
148146
ggplotly.ggplot <- function(p = ggplot2::last_plot(), width = NULL,
149147
height = NULL, tooltip = "all", dynamicTicks = FALSE,
150148
layerData = 1, originalData = TRUE, source = "A", ...) {
151-
# rectify tooltips, ggplot automatically convert `color` => `colour`
152-
tooltip <- rectify_tooltips(tooltip)
153149
l <- gg2list(p, width = width, height = height, tooltip = tooltip,
154150
dynamicTicks = dynamicTicks, layerData = layerData,
155151
originalData = originalData, source = source, ...)
@@ -1438,8 +1434,3 @@ getAesMap <- function(plot, layer) {
14381434
layer$mapping
14391435
}
14401436
}
1441-
1442-
rectify_tooltips <- function(tooltip){
1443-
tooltip[tooltip == "color"] <- "colour"
1444-
tooltip
1445-
}

R/layers2traces.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ layers2traces <- function(data, prestats_data, layout, p) {
2323
# turn symbol (e.g., ..count..) & call (e.g. calc(count)) mappings into text labels
2424
map <- ggfun("make_labels")(map)
2525

26+
2627
# filter tooltip aesthetics down to those specified in `tooltip` arg
2728
if (!identical(p$tooltip, "all")) {
29+
# rectify tooltips, ggplot automatically convert `color` => `colour`
30+
p$tooltip[p$tooltip == "color"] <- "colour"
2831
map <- map[names(map) %in% p$tooltip | map %in% p$tooltip]
2932
}
3033

0 commit comments

Comments
 (0)