if(interactive() && require(shiny)) {
library(shiny)
library(parallelPlot)
ui <- fluidPage(
selectInput(
"arrangeMethodSelect",
"Arrange Method:",
choices = list(
"fromLeft" = "fromLeft", "fromRight" = "fromRight",
"fromBoth" = "fromBoth", "fromNone" = "fromNone"
),
selected = "fromRight"
),
p("The selector controls the method used to arrange lines position in category boxes"),
parallelPlotOutput("parPlot")
)
server <- function(input, output, session) {
output$parPlot <- renderParallelPlot({
categorical <- list(
NULL, c(4, 6, 8), NULL, NULL, NULL, NULL, NULL, c(0, 1), c(0, 1), 3:5, 1:8
)
parallelPlot(mtcars, categorical = categorical, refColumnDim = "cyl")
})
observeEvent(input$arrangeMethodSelect, {
parallelPlot::setArrangeMethod("parPlot", input$arrangeMethodSelect)
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab