opts_toolbar: Toolbar settings

View source: R/girafe_options.R

opts_toolbarR Documentation

Toolbar settings

Description

Allows customization of the toolbar

Usage

opts_toolbar(
  position = c("topright", "top", "bottom", "topleft", "bottomleft", "bottomright"),
  saveaspng = TRUE,
  pngname = "diagram",
  tooltips = NULL,
  hidden = NULL,
  fixed = FALSE,
  delay_mouseover = 200,
  delay_mouseout = 500
)

Arguments

position

Position of the toolbar relative to the plot. One of 'top', 'bottom', 'topleft', 'topright', 'bottomleft', 'bottomright'

saveaspng

Show (TRUE) or hide (FALSE) the 'download png' button.

pngname

The default basename (without .png extension) to use for the png file.

tooltips

A named list with tooltip labels for the buttons, for adapting to other language. Passing NULL will use the default tooltips:

list( lasso_select = 'lasso selection', lasso_deselect = 'lasso deselection', zoom_on = 'activate pan/zoom', zoom_off = 'deactivate pan/zoom', zoom_rect = 'zoom with rectangle', zoom_reset = 'reset pan/zoom', saveaspng = 'download png' )

hidden

A character vector with the names of the buttons or button groups to be hidden from the toolbar.

Valid button groups: selection, zoom, misc

Valid button names: lasso_select, lasso_deselect, zoom_onoff, zoom_rect, zoom_reset, saveaspng

fixed

if FALSE (default), the toolbar will float above the graphic, if TRUE, the toolbar will be fixed and always visible.

delay_mouseover

The duration in milliseconds of the transition associated with toolbar display.

delay_mouseout

The duration in milliseconds of the transition associated with toolbar end of display.

Note

saveaspng relies on JavaScript promises, so any browsers that don't natively support the standard Promise object will need to have a polyfill (e.g. Internet Explorer with version less than 11 will need it).

See Also

Other girafe animation options: girafe_defaults(), girafe_options(), init_girafe_defaults(), opts_hover(), opts_selection(), opts_sizing(), opts_tooltip(), opts_zoom(), set_girafe_defaults()

Examples

library(ggplot2)

dataset <- mtcars
dataset$carname = row.names(mtcars)

gg <- ggplot(
  data = dataset,
  mapping = aes(x = wt, y = qsec, color = disp,
                tooltip = carname, data_id = carname) ) +
  geom_point_interactive() + theme_minimal()

x <- girafe(ggobj = gg)
x <- girafe_options(x,
  opts_toolbar(position = "top") )
if( interactive() ) print(x)

ggiraph documentation built on May 29, 2024, 4:46 a.m.