-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
DOC: get rid of matplotlib DeprecationWarning in plot_cluster_iris.py #22594
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
DOC: get rid of matplotlib DeprecationWarning in plot_cluster_iris.py #22594
Conversation
Thanks for your PR, can you follow the recommendations in #22586 to use projection='3d' and use |
Ah, sorry about that. I've pushed a new commit with the recommended changes. |
@lesteve I've made some more changes. Could you help me understand why this ci/circleci: doc-min-dependencies is failing? I'm not sure what the cause of this error is: |
Apparently you need the |
It looks like this is a relatively recent thing: the import is not needed for matplotlib >= 3.2: matplotlib/matplotlib#16192 (comment) Now you have a linting error, because you are importing something and you are not using it, can you do something like this: # unused but required import for doing 3d projections with matplotlib < 3.2
import mpl_toolkits.mplot3d # noqa: F401 |
I gave you the wrong error code to ignore indeed 🙄 ... |
No worries. This is my first PR so thank you for your patience and help. Please let me know if there's any additional tasks I need to do for this PR |
Looks good to me, merging, thanks a lot! |
Reference Issues/PRs
part of #22586.
What does this implement/fix? Explain your changes.
Removes the warning message produced by matplotlib in
examples/cluster/plot_cluster_iris.py
.The warning states: "Pass the keyword argument auto_add_to_figure=False and use fig.add_axes(ax) to suppress this warning. The default value of auto_add_to_figure will change to False in mpl3.5 and True values will no longer work in 3.6."
I added the keyword argument
auto_add_to_figure=False
and addedfig.add_axes(ax)
in the line below each use ofAxes3D
. I believe it should maintain the perspective and size of the plots compared to the solution found in #22547, which usesmatplotlib.figure.Figure.add_subplot
.