visible: Conceal & Reveal Figures

Description Usage Arguments Examples

Description

Conceal & reveal figures.

Usage

1
2
3
conceal(proxy, figures = NULL)

reveal(proxy, figures = NULL)

Arguments

proxy

A g2r proxy as returned by g2Proxy

figures

Index of figures to apply the change to.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(shiny)

ui <- fluidPage(
  actionButton("hide", "hide"),
  actionButton("show", "show"),
  g2Output("chart")
)

server <- function(input, output) {
  output$chart <- renderG2({
    g2(cars, asp(speed, dist)) %>% 
      fig_point() %>% 
      fig_line()
  })

  observeEvent(input$hide, {
    g2Proxy("chart") %>% 
      conceal()
  })

  observeEvent(input$show, {
    g2Proxy("chart") %>% 
      reveal()
  })
}

## Not run: shinyApp(ui, server)

JohnCoene/g2r documentation built on March 6, 2021, 8:11 p.m.