[Bug]: unavoidable DeprecationWarning
when using Patch3D
#21740
Labels
Milestone
DeprecationWarning
when using Patch3D
#21740
Bug summary
There's currently no nice way to avoid having a deprecation warning issued when using a custom subclass of
Patch3D
during drawing, caused by this helper function:matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
Lines 410 to 431 in 73304d2
added in #18302.
The deprecation is only triggered when axes are drawn, so within library code we can't locally suppress the warning, and have to modify global filters (or lie about our patches'
__module__
) to suppress the warning, even if we comply with the new calling convention (see for example Qiskit/qiskit#7301).Code for reproduction
Actual outcome
Running causes this warning to be emitted:
Expected outcome
It would be good to have a way to indicate that we support the new calling convention, so we can avoid triggering the warning - since it only happens when the figure is drawn, we can't reliably suppress the warning in library code without overriding the user's warning filters, which we very much don't want to do.
At the moment we're lying about our
__module__
to avoid leaking this to users, but that's not ideal for us. Perhapsmatplotlib
could check for some other "magic" attribute on the class (like_matplotlib_new_do_3d_projection
), or provide a "registration" function inmplot3d
which we can call to add our class to, so the z-order sorting knows it can call us with the new convention?Additional information
This appeared on our CI, so runs the gamut of OSs, Python versions, etc.
Operating system
No response
Matplotlib Version
3.5.0
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
pip
The text was updated successfully, but these errors were encountered: