Skip to content

Commit 8341a47

Browse files
authored
fix traceNames with frames (#1932)
* * fix traceNames * update NEWS * update tests figs from docker image * remove type = "scatter" and update tests SVGs
1 parent 9abcba9 commit 8341a47

File tree

14 files changed

+62
-18
lines changed

14 files changed

+62
-18
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## BUG FIXES
44

55
* `group_by.plotly()` now properly retains crosstalk information across `{dplyr}` versions (#1920).
6+
* Fixes some issues with `name` and `frames` when both attributes are specified. (#1903 and #1618).
67

78
# 4.9.3
89

R/plotly_build.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,12 +484,14 @@ registerFrames <- function(p, frameMapping = NULL) {
484484
d <- lapply(d, function(tr) { tr$visible <- tr$visible %||% TRUE; tr })
485485

486486
# if this frame is missing a trace name, supply an invisible one
487-
traceNamesMissing <- setdiff(frameTraceNames, sapply(d, "[[", "name"))
487+
traceNamesMissing <- setdiff(frameTraceNames, unlist(lapply(d, "[[", "name")))
488488
for (j in traceNamesMissing) {
489489
idx <- vapply(p$x$data, function(tr) isTRUE(tr[["name"]] == j), logical(1))
490-
idx <- which(idx)[[1]]
491-
invisible <- modify_list(p$x$data[[idx]], list(visible = FALSE))
492-
d <- c(d, list(invisible))
490+
if (any(idx)){
491+
idx <- which(idx)[[1]]
492+
invisible <- modify_list(p$x$data[[idx]], list(visible = FALSE))
493+
d <- c(d, list(invisible))
494+
}
493495
}
494496
p$x$frames[[i]] <- list(
495497
name = as.character(format(nm)),

tests/figs/density2d/density2d.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/deps.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
- vdiffr-svg-engine: 1.0
22
- vdiffr: 0.3.3.9000
3-
- freetypeharfbuzz: 0.2.5
3+
- freetypeharfbuzz: 0.2.6

tests/figs/geom-sf/sf-aspect.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/geom-sf/sf-axis-ticks.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/geom-sf/sf-fill-text.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/geom-sf/sf-points.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/geom-sf/sf.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-linetype/plotly-linetype-alphabetical.svg

Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)