Skip to contents

Unified visualisation for gap-filling outputs of the climasus4r pipeline. Automatically detects production mode (filled tibble) vs evaluation mode (list with data and metrics components) and renders appropriate interactive (plotly) or static (ggplot2) plots plus DT metric tables.

Production mode displays:

  • Time-series of observed (with gaps) vs imputed series.

  • Imputed segments as distinct markers. Consecutive imputed blocks are connected by a dotted line; isolated single points appear as dots only.

  • Interactive range-slider with zoom presets (plotly only).

Evaluation mode displays a 2×2 diagnostic dashboard:

  • Observed vs Predicted scatter with 1:1 reference line.

  • Residual distribution histogram.

  • Residuals over time (temporal-autocorrelation diagnostic).

  • Residuals vs observed (heteroscedasticity diagnostic).

Usage

sus_climate_plot_fill(
  df_filled,
  df_original = NULL,
  target_var,
  interactive = FALSE,
  output_type = c("plot", "table", "metrics", "all"),
  save_plot = NULL,
  lang = c("en", "pt", "es"),
  color_palette = c("npg", "aaas", "nejm", "lancet", "jama", "bmj", "jco", "frontiers",
    "gsea", "uchicago", "primer", "atlassian", "observable", "d3", "igv", "cosmic",
    "locuszoom", "ucscgb", "startrek", "tron", "futurama", "rickandmorty", "simpsons",
    "flatui", "bs5", "material", "tw3"),
  verbose = FALSE
)

Arguments

df_filled

Output of sus_climate_fill(). In production mode this is a <climasus_df> tibble; in evaluation mode it is the named list returned by sus_climate_fill(evaluation = TRUE).

df_original

Raw data before gap filling, e.g. from sus_climate_inmet(). Required in production mode; ignored in evaluation mode.

target_var

Character vector of variable(s) to visualise.

interactive

Logical. TRUE → plotly; FALSE → ggplot2 (default: TRUE).

output_type

What to return: "plot", "table", "metrics", or "all" (default: "all").

save_plot

Optional file path to save the plot (e.g. "plot.png" or "plot.html").

lang

Language: "en", "pt", or "es" (default: "en").

color_palette

ggsci palette name (default: "npg").

verbose

Print diagnostic information (default: FALSE).

Value

Depending on output_type, returns the plot, table, metrics, or a named list containing all four components: plot, table, metrics, data.