-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using dplyr 1.0.4., plot with controls created by crosstalk and plotly is not interactive any more #5760
Comments
Since updating dplyr, a plotly chart linked with a slider and a checkbox via crosstalk does not react to the controls any more. The following code works with dplyr version 1.0.2. In versions 1.0.3 and 1.0.4 I need to comment out the group_by() statement to make it work. Using the current development version of dplyr, 1.0.4.9000, did not help on my system. |
library(plotly)
library(crosstalk)
shared_data <- mtcars %>%
SharedData$new()
p <- shared_data %>%
plot_ly(x = ~mpg, y = ~hp) %>%
group_by(am) %>%
add_markers()
bscols(list(
filter_slider(id = "mpg", label = "Miles per Gallon",
sharedData = shared_data, column = "mpg"),
filter_checkbox(id = "am", label = "Automatic / Manual",
sharedData = shared_data, group = ~am)),
p) |
|
cc @cpsievert |
This happens because plotly is essentially assuming that m <- mtcars
attr(m, "foo") <- "a"
m <- dplyr::group_by(m, vs)
attr(m, "foo")
#> [1] "a"
m <- dplyr::group_by(m, cyl, .add = TRUE)
attr(m, "foo")
#> NULL I can make a fix for this in plotly, but maybe also something you want to address in dplyr? |
Thanks for looking into this, Romain!
Using remotes::install_github("tidyverse/dplyr"), I get dplyr version 1.0.4.9000. Get the same image that you posted, but the slider and the checkboxes have no effect on the plot, which they do when using dplyr version 1.0.2., or commenting out group_by() .
Originally posted by @fjodor in #5726 (comment)
The text was updated successfully, but these errors were encountered: