Skip to content

Fix incorrect connections in radar plots due to variable ordering#159

Merged
sbuis merged 1 commit into
mainfrom
fix/radar-plot-incorrect-connections
Mar 30, 2026
Merged

Fix incorrect connections in radar plots due to variable ordering#159
sbuis merged 1 commit into
mainfrom
fix/radar-plot-incorrect-connections

Conversation

@sbuis
Copy link
Copy Markdown
Member

@sbuis sbuis commented Mar 30, 2026

Description

This PR fixes an issue in radar plots where polygon lines incorrectly connect non-adjacent variables.

Problem

geom_polygon() was drawing segments based on the row order of the data, while the angular positions of variables were determined independently via the discrete x scale. When these orders differed, the resulting polygons were visually incorrect, with lines crossing between unrelated variables.

Solution

  • Explicitly enforce the ordering of var using factor levels
  • Align data ordering with the intended angular layout before plotting

This ensures that:

  • variables are displayed in the correct order around the radar chart
  • polygon edges connect only adjacent variables

Linked issues

Closes #158

Ensure consistent ordering between angular positions (x scale) and polygon drawing in radar plots.

Previously, `geom_polygon()` connected points using the row order of the data,
which could differ from the order of variables displayed on the radar axes.
This resulted in incorrect connections between non-adjacent variables.

Fix by explicitly setting the factor levels of `var` to match the intended
ordering and aligning data ordering before plotting.
@sbuis sbuis merged commit 414cb81 into main Mar 30, 2026
12 of 13 checks passed
@sbuis sbuis deleted the fix/radar-plot-incorrect-connections branch March 30, 2026 13:24
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.

Bug in radar plot: incorrect connections between rRMSE values

1 participant