setCategoriesRep: Categories Representation

View source: R/parallelPlot.R

setCategoriesRepR Documentation

Categories Representation

Description

Within a category column, the height assigned to each category can either be: equal for each category (EquallySizedBoxes); or calculated to reflect the proportion of lines passing through each category (EquallySpacedLines).

Usage

setCategoriesRep(id, categoriesRep)

Arguments

id

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

categoriesRep

One of the available category representations ("EquallySpacedLines", "EquallySizedBoxes").

Value

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

Examples

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

   ui <- fluidPage(
       selectInput(
         "categoriesRepSelect",
         "Categories Representation:",
         choices = list(
           "EquallySpacedLines" = "EquallySpacedLines", "EquallySizedBoxes" = "EquallySizedBoxes"
         ),
         selected = "EquallySpacedLines"
       ),
       p("The selector controls the the height assigned to each category"),
       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$categoriesRepSelect, {
           parallelPlot::setCategoriesRep("parPlot", input$categoriesRepSelect)
       })
   }

   shinyApp(ui, server)
 }


parallelPlot documentation built on April 19, 2023, 1:07 a.m.