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