View source: R/download_verif_plot.R
download_verif_plotUI | R Documentation |
The module's UI is a "Save" button that opens a modal where the user can select some options related to the download plot. When passing a list of options, the following elements must be included:
"score" - The score to plot.Must be preceded by the name of the element in the verification list, e.g. "ens_summary_scores_mean_bias".
"num_cases" - TRUE/FALSE - whether to include a number of cases panel.
"to_y_zero" - TRUE/FALSE - whether to include 0 on the y axis.
"x_axis" - the variable to plot on the x axis.
"facets" - the variables to facet by - should be unquoted and wrapped in
vars
. Set to NULL for no faceting.
"filters" - filtering expressions - should be unquoted and wrapped in
vars
. Set to NULL for no filtering.
"line_cols" - The variable to set the line colour aesthetic.
"highlight" - For deterministic verification of ensemble members - the member to highlight.
"flip_axes" - TRUE/FALSE - whether to flip the x and y axes.
n_cases_pos - The position of the number of cases panel.
download_verif_plotUI(id)
download_verif_plot(
input,
output,
session,
verif_data,
score_options,
colour_table
)
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 |
score_options |
A reactive list of options for the plot. This list is
output by |
colour_table |
A reactive data frame in a format suitable for the
|
library(shiny)
ui <- fluidPage(
download_verif_plotUI("dwnld")
)
server <- function(input, output, session) {
# Set options
opts <- list(
score = "ens_summary_scores_spread",
num_cases = FALSE,
to_y_zero = FALSE,
x_axis = "lead_time",
facets = NULL,
filters = NULL,
line_cols = "fcst_model",
highlight = NULL,
flip_axes = FALSE,
n_cases_pos = "bottom"
)
col_tbl <- data.frame(
fcst_model = unique(verif_data_ens$ens_summary_scores$fcst_model),
colour = c("red", "blue")
)
callModule(
download_verif_plot, "dwnld", reactive(verif_data_ens),
reactive(opts), reactive(col_tbl)
)
}
if (interactive()) {
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.