Creates a grouped bar chart comparing performance metrics across cohorts.
When a method column is present, bars are dodged by method for comparing
multiple approaches (e.g., MOO vs LASSO).
A data.frame from evaluate_panel_by_cohort(), or
any data frame with a cohort column and one or more metric columns.
Character vector specifying which metrics to plot. Defaults to all numeric columns except count columns.
One of "metric" (facet by metric, x-axis = cohort) or
"cohort" (facet by cohort, x-axis = metric). Defaults to "metric".
Logical; if TRUE, display metric values as text labels
on bars. Defaults to TRUE.
Numeric; text size for value labels. Defaults to 3.
Numeric vector of length 2 specifying y-axis limits, or
NULL for automatic limits. Defaults to c(0, 1).
Plot title. Defaults to "Per-Cohort Performance Comparison".
Optional plot subtitle.
A ggplot object.
# cohort_metrics <- evaluate_panel_by_cohort(panel, x_list, y_list)
# plot_cohort_comparison(cohort_metrics)
#
# Compare methods:
# moo_metrics$method <- "MOO"
# lasso_metrics$method <- "LASSO"
# plot_cohort_comparison(rbind(moo_metrics, lasso_metrics))