Creates a dot plot or bar chart showing the mean value for two time windows and their difference. Useful for communicating cumulative change (e.g., "recent decade vs pre-warming").
Usage
cd_plot_comparison(x, title = NULL, labels = c(a = "Recent", b = "Historical"))Arguments
- x
A tibble from
cd_compare()with columnsvariable,period,mean_a,mean_b,difference.- title
Optional plot title.
- labels
Named character vector of length 2 for window labels. Default
c(a = "Recent", b = "Historical").
Value
A ggplot2::ggplot object.
Examples
if (FALSE) { # \dontrun{
ts <- cd_extract(catalog, aoi)
cmp <- cd_compare(ts, window_a = 2015:2025, window_b = 1951:1980)
cd_plot_comparison(cmp, labels = c(a = "2015-2025", b = "1951-1980"))
} # }
