simpleDisplayUI: A shiny Module to display and save plots

Description Usage Arguments Value Examples

View source: R/simpleDisplay_module.R

Description

A shiny Module to display and save plots

display server function

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
simpleDisplayUI(id)

simpleDisplay(
  input,
  output,
  session,
  plot_list,
  params = reactiveValues(),
  save = TRUE,
  multirow = FALSE
)

Arguments

id

shiny id

input

shiny input

output

shiny output

session

shiny session

plot_list

a reactivevalues object containing a plot or a list of plots

params

reactivevalues object used to initialize plot parameters with the following elements (not mandatory):

use_plotly

: use plotly library to render an interactive plot

top

: main title

save

logical. Add buttons to save plot and plot data?

multirow

logical. Allow plots to be displayed on multiple rows?

Value

a reactivevalues object with:

plot

: the plots displayed

params

: input parameters. These include events describing user interaction with the plot such as:

plot_brush

: plot brush events

plot_click

: plot click events

plot_dblclick

: plot double click events

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## Not run: 
library(shiny)
library(shinydashboard)
library(gridExtra)
library(ggplot2)
library(plotly)

if (interactive()){

  ui <- dashboardPage(
    dashboardHeader(title = "simpleDisplay"),
    sidebar = dashboardSidebar(disable = TRUE),
    body = dashboardBody(
      fluidRow(
        column(12, box(width = NULL, simpleDisplayUI("simple_display_module")))
      )
    )
  )

  server <- function(input, output, session) {

    params <- reactiveValues(top = "Iris", use_plotly = FALSE)

    plot_list <- reactive({

      plist <- list()

      plist[[1]] <- ggplot(iris, aes(x=Sepal.Length, y = Sepal.Width, color = Species)) +
        geom_point(alpha = 0.5) +
        facet_wrap(~Species)

       plist[[2]] <- ggplot(iris, aes(x=Species, y = Sepal.Length, fill = Species)) +
         geom_col(alpha = 0.5)

      return(plist)

    })

    callModule(simpleDisplay, "simple_display_module", 
               plot_list = plot_list, 
               params = params,
               size = 500)

  }

  shinyApp(ui, server)

}

## End(Not run)

VoisinneG/flowR documentation built on June 1, 2021, 6:42 p.m.