Skip to content

axes.properties calls get_axes internally #5089

Closed

Description

@TomAugspurger

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

Activity

  1. WeatherGod commented on Sep 16, 2015

    @WeatherGod
    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 notifications@github.com
    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.

  2. tacaswell commented on Sep 16, 2015

    @tacaswell
    Member

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

  3. josePhoenix commented on Nov 3, 2015

    @josePhoenix

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

  4. added this to the milestone on Nov 3, 2015
  5. tacaswell commented on Nov 3, 2015

    @tacaswell
    Member

    The first thing that feel through the cracks for 1.5.0

  6. TomAugspurger commented on Nov 3, 2015

    @TomAugspurger
    ContributorAuthor

    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.

  7. modified the milestones: , on Nov 8, 2015
  8. self-assigned this
    on Dec 21, 2015
  9. added a commit that references this issue on Dec 21, 2015
    d6fdeba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions