Fix data ordering in PositionStack #3401
Closed
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.
Fixes #3390 by resetting the data order in
PositionStack
after positive and negative values have been collided. I looked into this and I don't think that it causes downstream problems with plot appearance, but I don't think we can completely avoid messing with ordering in the position without causing breaking changes, as this is where we ensure that stacking order matches the default legend order, and users also have the option to alter stacking order fromposition_stack(reverse = TRUE)
. So instead I havePositionStack()
resetting the order aftercollide()
. @thomasp85 does this seem ok to you?It did cause some test failures that all appear to be false negatives: some regular tests expected the results of
layer_data()
to be in a different order (but the plots look the same), and one visual test failed because the rows in the SVG were in a different order (again, the plot itself looked the same). I fixed these and added a couple extra visual tests as well. I removed the test for "negative and positive values are handled separately" as I can't think of a way to test for that after we've sorted the combined data.