Skip to content

axes.properties calls get_axes internally #5089

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

Closed
TomAugspurger opened this issue Sep 16, 2015 · 5 comments
Closed

axes.properties calls get_axes internally #5089

TomAugspurger opened this issue Sep 16, 2015 · 5 comments
Assignees
Milestone

Comments

@TomAugspurger
Copy link
Contributor

This results in a un-fixable warning

In [2]: import matplotlib.pyplot as plt

In [3]: fig, ax = plt.subplots()

In [4]: ax.properties()
/Users/tom.augspurger/Envs/dev/lib/python3.4/site-packages/matplotlib-1.5.0rc1+0.gab00a04.dirty-py3.4-macosx-10.10-x86_64.egg/matplotlib/artist.py:221: MatplotlibDeprecationWarning: This has been deprecated in mpl 1.5, please use the
axes property.  A removal date has not been set.
  warnings.warn(_get_axes_msg, mplDeprecation, stacklevel=1)

The root cause is a call to ax.get_axes().

This is on the RC by the way, and probably is from #4686

@WeatherGod
Copy link
Member

ooh boy... yeah... This is harmless, but annoying. And can be an issue in
the future.

When calling properties() for an artist, it will dir() the object
itself, and find any "get_*" methods that are callable. It tosses any
aliases, and builds up a dictionary of results from calling all of those
getters. Therefore, it also picks up the get_axes() method, thereby
incurring the warning.

If we are deprecating get_axes(), then that means we are changing the
output of properties(). We should probably modify this method so that we
filter out deprecated "get_*" methods, and fetch them via their respective
property instead, I think.

Thoughts?

On Wed, Sep 16, 2015 at 1:55 PM, Tom Augspurger [email protected]
wrote:

This results in a un-fixable warning

In [2]: import matplotlib.pyplot as plt

In [3]: fig, ax = plt.subplots()

In [4]: ax.properties()/Users/tom.augspurger/Envs/dev/lib/python3.4/site-packages/matplotlib-1.5.0rc1+0.gab00a04.dirty-py3.4-macosx-10.10-x86_64.egg/matplotlib/artist.py:221: MatplotlibDeprecationWarning: This has been deprecated in mpl 1.5, please use the
axes property. A removal date has not been set.
warnings.warn(_get_axes_msg, mplDeprecation, stacklevel=1)

The root cause is a call to ax.get_axes().


Reply to this email directly or view it on GitHub
#5089.

@tacaswell
Copy link
Member

@WeatherGod Sounds right to me. I remember doing this in some functions, may setp and getp?

@josePhoenix
Copy link

Just came across this warning myself and found this issue, +1 to the proposed solution

@tacaswell tacaswell added this to the next major release (2.0) milestone Nov 3, 2015
@tacaswell
Copy link
Member

The first thing that feel through the cracks for 1.5.0

@TomAugspurger
Copy link
Contributor Author

Not the worst issue to miss!

For people looking for a workaround.

In [1]: from matplotlib.cbook import MatplotlibDeprecationWarning

In [2]: import warnings

In [3]: fig, ax = plt.subplots()

In [4]: warnings.simplefilter('ignore', MatplotlibDeprecationWarning)

In [5]: _ = ax.properties()

cavet emptor and all that, you could be silencing important warnings.

@mdboom mdboom modified the milestones: Critical bugfix release (1.5.1), next major release (2.0) Nov 8, 2015
@tacaswell tacaswell self-assigned this Dec 21, 2015
tacaswell added a commit to tacaswell/matplotlib that referenced this issue Dec 21, 2015
Calling `get_axes` currently raises a deprecating warning, eat this.

The Artist.properties function will be completely re-written in 2.1 with
traitlets so this is a reasonable stop-gap for now.

closes matplotlib#5089
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

No branches or pull requests

6 participants