colour_choices: Shiny module for picking colours

View source: R/colour_choices.R

colour_choicesUIR Documentation

Shiny module for picking colours

Description

The UI includes a button with a palette icon for opening a modal to pick colours for a plot. The output is a data frame that can be used to control colours in plotting point verification scores using the plot_point_verif function.

Usage

colour_choicesUI(id)

colour_choices(input, output, session, verif_data)

Arguments

id

An ID string for the module's UI

input

input reactive

output

output reactive

session

Session from which to make a child scope (the default should almost always be used).

verif_data

verification data as a reactive value

Details

Note that the module uses the "old" semantics for shiny modules so should be called with callModule rather than moduleServer.

Value

A reactive data frame to be used as input to the colour_table argument in plot_point_verif.

Examples

library(shiny)

ui <- fluidPage(
  colour_choicesUI("cols"),
  plotOutput("verifPlot")
)

server <- function(input, output, session) {
  col_table <- callModule(colour_choices, "cols", reactive(verif_data_ens))
  output$verifPlot <- renderPlot({
    plot_point_verif(
      verif_data_ens, spread, colour_table = col_table(),
      plot_num_cases = FALSE
    )
  })
}

if (interactive()) {
  shinyApp(ui, server)
}



andrew-MET/harpVis documentation built on March 11, 2024, 9:34 a.m.