plotly/plotly.R

New feature request: a modeBarButtonsToKeep argument in the config function

開放

#1,740 建立於 2020年4月7日

 (2 則留言) (3 個反應) (0 位負責人)R (643 個分叉)github user discovery
good-for-first-time-contributionhelp wanted

倉庫指標

星標
 (2,671 顆星)
PR 合併指標
 (平均合併 1天 16小時) (30 天內合併 2 個 PR)

描述

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"))

貢獻者指南