clear_plotly_options: Remove Plotly Options

Description Usage Arguments Value Examples

View source: R/plotly_functions.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# 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"))

## End(Not run)

KoderKow/kowr documentation built on July 19, 2021, 4:18 p.m.