if(interactive() && require(shiny)) {
library(shiny)
library(parallelPlot)
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"),
parallelPlotOutput("parPlot")
)
server <- function(input, output, session) {
output$parPlot <- renderParallelPlot({
parallelPlot(data = iris, refColumnDim = "Species")
})
observeEvent(input$categoricalCsSelect, {
parallelPlot::setCategoricalColorScale("parPlot", input$categoricalCsSelect)
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab