Learn R Programming

scatterPlotMatrix (version 0.3.0)

setDistribType: Distribution plots

Description

Tells which type of representation to use for distribution plots.

Usage

setDistribType(id, distribType)

Value

No return value, called from shiny applications for side effects.

Arguments

id

Output variable to read from (id which references the requested plot).

distribType

Binary code indicating the type of distribution plot (bit 1: histogram, bit 2: density plot).

Examples

Run this code
 if(interactive() && require(shiny)) {
   library(shiny)
   library(scatterPlotMatrix)

   ui <- fluidPage(
     selectInput(
       "distribType",
       "Distribution Representation:",
       choices = list("Histogram" = 2, "Density Plot" = 1),
       selected = 2
     ),
     p("The selector controls type of representation to use for distribution plots"),
     scatterPlotMatrixOutput("spMatrix")
   )

   server <- function(input, output, session) {
     output$spMatrix <- renderScatterPlotMatrix({
       scatterPlotMatrix(iris)
     })
     observeEvent(input$distribType, {
       scatterPlotMatrix::setDistribType("spMatrix", input$distribType)
     })
   }

   shinyApp(ui, server)
 }

Run the code above in your browser using DataLab