View source: R/scatterPlotMatrix.R
setCategoricalColorScale | R Documentation |
Tells which color scale to use when the Z axis is set to a categorical column.
setCategoricalColorScale(id, categoricalCsId)
id |
Output variable to read from (id which references the requested plot). |
categoricalCsId |
One of the available color scale ids (Category10, Accent, Dark2, Paired, Set1). |
No return value, called from shiny applications for side effects.
if(interactive() && require(shiny)) {
library(shiny)
library(scatterPlotMatrix)
ui <- fluidPage(
selectInput(
"categoricalCsSelect",
"Categorical Color Scale:",
choices = list(
"Category10" = "Category10", "Accent" = "Accent", "Dark2" = "Dark2",
"Paired" = "Paired", "Set1" = "Set1"
),
selected = "Category10"
),
p("Selector controls used colors when reference column is of type categorical"),
scatterPlotMatrixOutput("spMatrix")
)
server <- function(input, output, session) {
output$spMatrix <- renderScatterPlotMatrix({
scatterPlotMatrix(iris, zAxisDim = "Species")
})
observeEvent(input$categoricalCsSelect, {
scatterPlotMatrix::setCategoricalColorScale("spMatrix", input$categoricalCsSelect)
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.