setContinuousColorScale: Continuous color scale

View source: R/scatterPlotMatrix.R

setContinuousColorScaleR Documentation

Continuous color scale

Description

Tells which color scale to use when the Z axis is set to a continuous column.

Usage

setContinuousColorScale(id, continuousCsId)

Arguments

id

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

continuousCsId

One of the available color scale ids (Viridis, Inferno, Magma, Plasma, Warm, Cool, Rainbow, CubehelixDefault, Blues, Greens, Greys, Oranges, Purples, Reds, BuGn, BuPu, GnBu, OrRd, PuBuGn, PuBu, PuRd, RdBu, RdPu, YlGnBu, YlGn, YlOrBr, YlOrRd).

Value

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

Examples

 if(interactive() && require(shiny)) {
   library(shiny)
   library(scatterPlotMatrix)

   ui <- fluidPage(
     selectInput(
       "continuousCsSelect",
       "Continuous Color Scale:",
       choices = list(
         "Viridis" = "Viridis", "Inferno" = "Inferno", "Magma" = "Magma",
         "Plasma" = "Plasma", "Warm" = "Warm", "Cool" = "Cool", "Rainbow" ="Rainbow",
         "CubehelixDefault" = "CubehelixDefault", "Blues" = "Blues",
         "Greens" = "Greens", "Greys" = "Greys", "Oranges" = "Oranges",
         "Purples" = "Purples", "Reds" = "Reds", "BuGn" = "BuGn", "BuPu" = "BuPu",
         "GnBu" = "GnBu", "OrRd" = "OrRd", "PuBuGn" = "PuBuGn", "PuBu" = "PuBu",
         "PuRd" = "PuRd", "RdBu" = "RdBu", "RdPu" = "RdPu", "YlGnBu" = "YlGnBu",
         "YlGn" = "YlGn", "YlOrBr" = "YlOrBr", "YlOrRd" = "YlOrRd"
       ),
       selected = "Viridis"
     ),
     p("Selector controls used colors when reference column is of type continuous"),
     scatterPlotMatrixOutput("spMatrix")
   )

   server <- function(input, output, session) {
     output$spMatrix <- renderScatterPlotMatrix({
       scatterPlotMatrix(iris, zAxisDim = "Sepal.Length")
     })
     observeEvent(input$continuousCsSelect, {
       scatterPlotMatrix::setContinuousColorScale("spMatrix", input$continuousCsSelect)
     })
   }

   shinyApp(ui, server)
 }


scatterPlotMatrix documentation built on June 22, 2024, 10:50 a.m.