plotly/plotly.R

New feature request: a modeBarButtonsToKeep argument in the config function

Ouverte

#1 740 ouverte le 7 avr. 2020

 (2 commentaires) (3 réactions) (0 personne assignée)R (643 forks)github user discovery
good-for-first-time-contributionhelp wanted

Métriques du dépôt

Stars
 (2 671 étoiles)
Métriques de merge PR
 (Merge moyen 1j 16h) (2 PRs mergées en 30 j)

Description

Currently plotly has a function to remove listed mode bar buttons.

It'd be nice if it had a function to keep listed mode bar buttons, and to drop the rest.

Otherwise the code is quite long-winded if a user only wants to keep one button, such as the camera.

This argument could be called modeBarButtonsToKeep

library(dplyr)
library(ggplot2)

plot <- ggplot(iris) +
  geom_point(aes(Sepal.Width, Sepal.Length))

plotly::ggplotly(plot) %>% 
  plotly::config(modeBarButtonsToRemove = list("zoom2d", "pan2d", "zoomIn2d", "zoomOut2d", 
"autoScale2d","resetScale2d", "hoverClosestCartesian", "hoverCompareCartesian", 
"sendDataToCloud", "toggleHover", "resetViews", "toggleSpikelines", "resetViewMapbox", 
"toggleSpikelines", "resetViewMapbox", "lasso2d", "select2d"))

Guide contributeur