Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: fully invalidate TransformWrapper parents before swapping #25126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2023

Conversation

tacaswell
Copy link
Member

PR Summary

The issue is that TransformedPath only regenerates its cache for changes to the non-affine part of the transform. When TransformWrapper for tranScale changes from log -> linear the non-affine part of the log transform is still cached, but when the transforms are invalidated after switching to linear the invalidation only reports changing the affine part so the cache in TransformedPath escapes being updated (nulled out in this case) and when we re-draw with linear is drawing the line off screen (or at least clipped).

This change invalidates all of the parents before changing the internals of TransformWrapper before we switch it which will cause the non-affine part to be correctly recomputed the next time we need it.

closes #25124

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

The issue is that TransformedPath only regenerates its cache for changes to the
non-affine part of the transform.  When TransformWrapper for tranScale changes
from log -> linear the non-affine part of the log transform is still cached,
but when the transforms are invalidated after switching to linear the
invalidation only reports changing the affine part so the cache in
TransformedPath escapes being updated (nulled out in this case) and when we
re-draw with linear is drawing the line off screen (or at least clipped).

This change invalidates all of the parents before changing the internals of
TransformWrapper before we switch it which will cause the non-affine part to be
correctly recomputed the next time we need it.

closes matplotlib#25124
@tacaswell tacaswell added this to the v3.7.0 milestone Feb 1, 2023
@tacaswell
Copy link
Member Author

also, like 2 hours of debugging to change 1 line of code 🤣

@anntzer anntzer merged commit a046ee3 into matplotlib:main Feb 2, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 2, 2023
@tacaswell tacaswell deleted the fix_lines_change_scale branch February 2, 2023 22:02
tacaswell added a commit that referenced this pull request Feb 3, 2023
…126-on-v3.7.x

Backport PR #25126 on branch v3.7.x (FIX: fully invalidate TransformWrapper parents before swapping)
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
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]: ax.plot(x,y) disappears after changing y_scale
3 participants