config is not overwritting `ModeBarButtons` slot
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
I have noticed that after placing a ModeBarButtons configuration, it is not overwritten / updated downstream.
Reproducible example:
library(plotly)
#> Loading required package: ggplot2
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
# This plotly only has the `toImage` modeBarButton
plot1 <- plot_ly() %>%
config(displaylogo = FALSE) %>%
config(modeBarButtons = list(list("toImage")))
plot1$x$config$modeBarButtons
#> [[1]]
#> [[1]][[1]]
#> [1] "toImage"
# This plotly also has the `toImage` modeBarButton only
plot2 <- plot_ly() %>%
config(displaylogo = FALSE) %>%
config(modeBarButtons = list(list("toImage"))) %>%
config(modeBarButtons = list(list("zoom")))
plot2$x$config$modeBarButtons
#> [[1]]
#> [[1]][[1]]
#> [1] "toImage"
Created on 2022-11-29 with reprex v2.0.2
This holds true for config(modeBarButtonsToAdd ...)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the config() entry point and reproduce the two examples from the issue, comparing plot1$x$config$modeBarButtons with plot2$x$config$modeBarButtons. The fix is complete when a later modeBarButtons configuration updates the earlier value, and the same behavior is verified for modeBarButtonsToAdd.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100