Shortcut for removing the options on the top of a plotly plot.

clear_plotly_options(plotly_object, buttons_to_keep = NULL, keep_logo = FALSE)

Arguments

plotly_object

A plotly object.

buttons_to_keep

A string. Default is NULL. Use a vector of strings for multiple buttons to keep. Below is a list of items with the plotly code that corresponds to the text displayed on the plotly plot when hovering over the buttons.

  • toImage: Download plot as a png

  • zoom2d: Zoom

  • pan2d: Pan

  • select2d: Box Select

  • lasso2d: Lasso Select

  • zoomIn2d: Zoom in

  • zoomOut2d: Zoom out

  • autoScale2d: Autoscale

  • resetScale2d: Reset axes

  • toggleSpikelines: Toggle Spike Lines

  • hoverClosestCartesian: Show closest data on hover

  • hoverCompareCartesian: Compare data on hover

keep_logo

A logical. Default is FALSE. Set to `TRUE`` to keep the "Produced with Plotly" button located in the top right of the plot.

Value

A plotly object.

Examples

if (FALSE) { # remove all options p %>% clear_plotly_options() # keep Download plot as a png button p %>% clear_plotly_options(buttons_to_keep = "toImage") # keep zoom in and zoom out buttons p %>% clear_plotly_options(buttons_to_keep = c("zoomIn2d", "zoomOut2d")) }