Skip to content

Conversation

@kaitejohnson
Copy link
Collaborator

@kaitejohnson kaitejohnson commented Jan 5, 2026

  • Add shapes as an additional distinguisher between models and makes legends

Summary by CodeRabbit

  • New Features

    • Enhanced model differentiation in plots through visual shape indicators alongside colour coding.
    • Configurable legend display for improved plot flexibility.
  • Improvements

    • Refined legend visibility controls across visualisations.
    • Improved visual consistency and aesthetic refinements in plot presentations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

Walkthrough

This pull request introduces shape aesthetics for models in plotting functions, adds a new add_shape parameter to control shape legend display, and expands legend handling across plotting targets by introducing remove_legend parameters to control legend visibility in various plots.

Changes

Cohort / File(s) Summary
Overall scores plotting function
R/fig_overall_scores.R
Adds shape mapping for models alongside existing colour mappings. Introduces add_shape parameter (default: FALSE) to optionally display shape legend. Updates get_plot_overall() function signature. Adjusts legend guides and layout, removes redundant axis labels, and refactors legend handling when remove_legend is TRUE.
Plotting style configuration
R/plotting_style.R
Introduces model_shapes mapping for model names to numeric shape codes. Includes model_shapes in plot_comp_list output for shape control.
Plot targets configuration
targets/fig_overall_targets.R
Adds remove_legend parameter to multiple plotting targets: CA-related bar charts and relative skill plots, and by-location relative skill plot. Sets visibility to TRUE or FALSE as appropriate for each target.

Possibly related PRs

  • epiforecasts/evalvariantnowcasthub#20: Touches the same plotting code in R/fig_overall_scores.R and R/plotting_style.R, including modifications to get_plot_overall and plot styling components.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references Issue 54 and indicates the objective (colorblind friendly) but the actual changeset focuses on adding shape aesthetics to distinguish models, which is a technical implementation detail not explicitly mentioned in the title.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 54-colorblind-friendly

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kaitejohnson kaitejohnson marked this pull request as ready for review January 5, 2026 11:17
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
R/fig_overall_scores.R (1)

603-637: Missing scale_shape_manual in absolute scores block.

Whilst the shape aesthetic is mapped to model at line 621 and the shape legend is configured in guides, the scale_shape_manual call is missing. This means ggplot2 will use default shapes rather than the custom model_shapes defined in plot_components(), defeating the accessibility purpose of this PR.

In contrast, the relative skill block (lines 560-596) correctly includes scale_shape_manual at line 584.

🔎 Proposed fix
       )
     ) +
     scale_color_manual(values = plot_components_list$model_colors) +
+    scale_shape_manual(values = plot_components_list$model_shapes) +
     geom_vline(xintercept = 0, linetype = "dashed", color = "gray50") +
     get_plot_theme() +
🧹 Nitpick comments (1)
R/fig_overall_scores.R (1)

500-515: Clarify the interaction between remove_legend and add_shape parameters.

The current logic allows add_shape = TRUE to override remove_legend = TRUE for the shape legend specifically. This creates an asymmetric API where:

  • If remove_legend = TRUE and add_shape = TRUE: shape legend shows, but colour/fill legends are hidden
  • If remove_legend = TRUE and add_shape = FALSE: all legends are hidden

Whilst this may be intentional, consider documenting this behaviour explicitly in the function documentation to prevent confusion.

💡 Suggested documentation enhancement
 #' @param remove_legend Boolean indicating whether to keep legend, default
 #'   is TRUE.
 #' @param add_shape Boolean indicating whether to add the shape legend,
-#'  default is FALSE.
+#'  default is FALSE. Note: when TRUE, this overrides remove_legend for
+#'  the shape aesthetic only.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14fed30 and b38785c.

📒 Files selected for processing (3)
  • R/fig_overall_scores.R
  • R/plotting_style.R
  • targets/fig_overall_targets.R
🔇 Additional comments (5)
R/plotting_style.R (1)

60-67: Excellent addition of shape aesthetics for accessibility.

The shape mappings are well-chosen and use standard ggplot2 shape codes that will provide clear visual distinction between models for colorblind users.

targets/fig_overall_targets.R (1)

105-105: Legend visibility controls are well-coordinated.

The selective legend removal for CA plots and by-location plots aligns well with the multi-panel figure layout strategy where legends are collected at the top level.

Also applies to: 113-114, 122-123, 222-223

R/fig_overall_scores.R (3)

74-111: Shape aesthetics correctly integrated for accessibility.

The implementation properly adds shape mapping alongside colour, includes the appropriate scale_shape_manual, and coordinates legend guides for both aesthetics.


197-227: Shape aesthetics consistently applied across both plot types.

Both the relative skill and absolute score paths correctly implement shape mapping with proper scales and legend configurations.

Also applies to: 247-296


674-675: Consistent bar chart styling applied.

The use of fixed black fill for sequence count bar charts provides clear, simple visualisation without redundant legend items.

Also applies to: 700-701, 728-729

@kaitejohnson kaitejohnson merged commit ac058fa into main Jan 5, 2026
3 checks passed
@kaitejohnson kaitejohnson deleted the 54-colorblind-friendly branch January 5, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants