fix(plot): ensure correct per-facet axis bounds assignment in scatter plots (#140)#141
Merged
Merged
Conversation
…riable ordering mismatch (#140)
|
📝 Styler has automatically formatted the following R files in this PR:
Please pull these changes to your local branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix incorrect axis bounds assignment in
plot()scatter panels caused by inconsistentordering between computed variable bounds and actual facet display order.
Problem
Axis limits were computed per variable using grouped data, but applied to facets
by positional index. When the ordering of variables in the data differed from
the facet display order in the ggplot object, axis limits were assigned to the
wrong panels.
This resulted in mismatched axis scaling across facets.
Root Cause
compute_axis_bounds()returned unnamed vectors.make_axis_square()andforce_y_axis()relied on positional matching.which may differ from grouped data order.
Changes
compute_axis_bounds()now returns named vectors indexed by variable name.get_facet_order()to retrieve actual facet layoutorder using
ggplot_build().make_axis_square()to reorder axis bounds according tothe real facet display order.
force_y_axis()to apply the same logic.Closes #140.