8000 Fix parasite_axes does not properly handle units by anntzer · Pull Request #26078 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix parasite_axes does not properly handle units #26078

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
Jul 15, 2023
Merged

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Jun 5, 2023

Right now parasite_axes just use self._parent_axes._get_lines as self._get_lines, but it can't update the axes unit when there are twin axes. Therefore, we need to provide axes=self as an extra args to handle this. We also need to change the callees to use axes in kwargs when provided.

The test creates a plot with twin axes where both axes have units. It then checks whether units are appended correctly on the respective axes. The code base without the modification fails the unit test whereas the modification makes it pass the unit test.

Revival of #22789 (I modified the OP's PR), integrating the changes at #22789 (comment).

Closes #22714

PR summary

PR checklist

@tacaswell
Copy link
Member

Failures are real and related.

@anntzer
Copy link
Contributor Author
anntzer commented Jun 5, 2023

Woops, fixed now.

Right now parasite_axes just use self._parent_axes._get_lines as
self._get_lines, but it can't update the axes unit when there are twin
axes. Therefore, we need to provide axes=self as an extra args to handle
this. We also need to change the callees to use axes in kwargs when
provided.

The test creates a plot with twin axes where both axes have units. It
then checks whether units are appended correctly on the respective
axes. The code base without the modification fails the unit test whereas
the modification makes it pass the unit test.
@ksunden ksunden added this to the v3.8.0 milestone Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: parasite_axes does not properly handle units
5 participants
0