Skip to content
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

Some tests accessing matplotlib.axes.Axes.artists fail with Matplotlib 3.5.0b1 #442

Closed
Tracked by #443
hakonanes opened this issue Sep 9, 2021 · 9 comments
Closed
Tracked by #443
Labels
tests This relates to the tests
Milestone

Comments

@hakonanes
Copy link
Member

hakonanes commented Sep 9, 2021

Specific tests: https://github.com/hyperspy/hyperspy-extensions-list/runs/3551171059?check_suite_focus=true#step:13:1

Don't know why, but this should be fixed. Using matplotlib 3.5 shouldn't break any functionality, just tests.

Solution: In the tests, we should access the patches (artists) from Axes.patches, since that's what they are. And add them to the axes via Axes.add_patch() instead of Axes.add_artist().

@hakonanes hakonanes added the tests This relates to the tests label Sep 9, 2021
@hakonanes hakonanes added this to the v0.5.2 milestone Sep 9, 2021
@hakonanes
Copy link
Member Author

Again, thanks to @ericpre for running kikuchipy and other HyperSpy extensions against development versions of our dependencies at https://github.com/hyperspy/hyperspy-extensions-list.

@hakonanes hakonanes modified the milestones: v0.5.2, v0.6.0 Sep 9, 2021
@ericpre
Copy link
Contributor

ericpre commented Sep 9, 2021

The failure seems to be related with a API deprecation to remove artists in matplotlib 3.5 but as you will know, it should be only warning. Sometimes, it is possible that there is a bug in the deprecation, in which case, it will be good that you report it while matplotlib in still in beta/rc.

@ericpre
Copy link
Contributor

ericpre commented Sep 9, 2021

Again, thanks to @ericpre for running kikuchipy and other HyperSpy extensions against development versions of our dependencies at https://github.com/hyperspy/hyperspy-extensions-list.

What would be great to do: hyperspy/hyperspy-extensions-list#13

@hakonanes
Copy link
Member Author

The failure seems to be related with a API deprecation to remove artists in matplotlib 3.5 but as you will know, it should be only warning.

I checked, and neither an error nor a warning is raised by Matplotlib when adding an artist and then accessing Axes.artists... Do you know where the artists are accessible from? I couldn't find any release notes/changelog for Matplotlib v3.5.0b1 either. I'll wait to raise an issue until I know what such a document says which behaviour I'm to expect.

@hakonanes
Copy link
Member Author

Do you know where the artists are accessible from?

Apparently from Axes.patches, which is fine by me. Found it here matplotlib/matplotlib#20895 (comment).

@hakonanes
Copy link
Member Author

However we should change the ax.add_artist() call to ax.add_patch() to make the outcome transparent.

@ericpre
Copy link
Contributor

ericpre commented Sep 9, 2021

Sorry, my comments above was slightly misleading - in hyperspy, there are warnings about removing artists!

However we should change the ax.add_artist() call to ax.add_patch() to make the outcome transparent.

Yes, according to https://matplotlib.org/devdocs/api/next_api_changes/deprecations/18216-ES.html, this seems to be on the right track. This and changing how to assert where they are kept!

@hakonanes
Copy link
Member Author

Thanks for the link to the page I was after!

@hakonanes hakonanes mentioned this issue Sep 10, 2021
2 tasks
@hakonanes hakonanes modified the milestones: v0.6.0, v0.5.2 Sep 10, 2021
@hakonanes
Copy link
Member Author

Fixed in #445.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests This relates to the tests
Projects
None yet
Development

No branches or pull requests

2 participants