I am trying to plot 3 types of data (A, B, C), and to filter them with respect to two time points (1, 2).
Here is a minimum working example:
set.seed(1234)
data.frame(a = rep(c(1, 2), each = 6),
b = rep(c("A", "B", "C"), 4),
x = runif(12),
y = runif(12)) %>%
plot_ly(x = ~x,
y = ~y,
type = 'scatter',
mode = 'markers',
color = ~b,
transforms = list(list(
type = 'filter',
target = ~a,
operation = '=',
value = 1))) %>%
layout(updatemenus = list(
list(
type = 'dropdown',
active = 0,
buttons = apply(as.data.frame(c(1, 2)), 1,
function(x) list(method = 'restyle',
args = list('transforms[0].value', x),
label = x)))
)
)
Strangely enough, the “C” dots does not appear, but are merged with the “A” dots.
Adding
filter(a == 1) %>%
Solves the problem. But, I am ultimately willing to add an updatemenus
.
It seems a bug to me. What do you think?