Toggle the visibily of a chart.

action_toggle_visibility(g, btn)

Arguments

g

An object of class g2r or g2Proxy as returned by g2() or g2_proxy().

btn

Id of the input_button that toggles the visibility.

Examples

# works in Rmarkdown
input_button("toggle", "Show/hide chart")

g2(mtcars, asp(qsec, mpg)) %>%
  fig_point() %>%
  action_toggle_visibility("toggle")