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

AttributeError: 'GeoAxesSubplot' object has no attribute '_hold' #1120

Closed
zssherman opened this issue Sep 24, 2018 · 6 comments
Closed

AttributeError: 'GeoAxesSubplot' object has no attribute '_hold' #1120

zssherman opened this issue Sep 24, 2018 · 6 comments
Assignees
Milestone

Comments

@zssherman
Copy link

zssherman commented Sep 24, 2018

Description

Hello, when running Travis on our package https://travis-ci.org/ARM-DOE/pyart/jobs/432631010#L1645-L1675. I encountered the error in the traceback below.

Looking into it more, it seems that in matplotlib 3.0.0, axes attribute hold was removed.
https://matplotlib.org/api/api_changes.html#removals

In geoaxes.py, hold is used. Matplotlib 3.0.0.
https://github.com/SciTools/cartopy/blob/master/lib/cartopy/mpl/geoaxes.py#L1450-L1465

Code

https://github.com/SciTools/cartopy/blob/master/lib/cartopy/mpl/geoaxes.py#L1450-L1465

Traceback

./../../miniconda3/envs/testenv/lib/python3.6/site-packages/cartopy/mpl/geoaxes.py:1451: in pcolormesh
    result = self._pcolormesh_patched(*args, **kwargs)

def _pcolormesh_patched(self, *args, **kwargs):
        """
            A temporary, modified duplicate of
            :func:`~matplotlib.pyplot.pcolormesh'.
    
            This function contains a workaround for a Matplotlib issue
            and will be removed once the issue has been resolved.
            https://github.com/matplotlib/matplotlib/pull/1314
    
            """
        import warnings
        import matplotlib.colors as mcolors
        import matplotlib.collections as mcoll
    
>       if not self._hold:
E       AttributeError: 'GeoAxesSubplot' object has no attribute '_hold'
Full environment definition

Operating system

Ubuntu 14.04.5 LTS

Cartopy version

cartopy=0.16.0

conda list

python=3.6.6
matplotlib=3.0.0
numpy=1.15.1
@dopplershift
Copy link
Contributor

So, I see the function says:

This function contains a workaround for a Matplotlib issue
and will be removed once the issue has been resolved.
matplotlib/matplotlib#1314

This issue was apparently fixed in matplotlib 1.2.x...so considering we only support matplotlib >=1.5, should we just nuke this function and be done?

It would seem this should probably push us to get 0.17 out the door ASAP with whatever we have done.

@dopplershift dopplershift added this to the 0.17 milestone Sep 25, 2018
@dopplershift
Copy link
Contributor

@zssherman Can you try monkey patching for me and see if it fixes PyART?

from matplotlib.axes import Axes
from cartopy.mpl.geoaxes import GeoAxes
GeoAxes._pcolormesh_patched = Axes.pcolormesh

To be clear, I don't recommend this as anything you guys ship, but want to see if that's enough to fix it.

@zssherman
Copy link
Author

@dopplershift Sounds good! I will do the change and see if it fixes it. Thanks for the suggestion! And yeah I'll take your recommendation and not ship that.

@dopplershift
Copy link
Contributor

I also think matplotlib will put _hold back for us (as a do-nothing bit of code) in 3.0.1.

@zssherman
Copy link
Author

@dopplershift Ah gotcha. And the monkey patch seems to work for radarmapdisplay_cartopy. I will submit a pull request to pyart for the mean time as a temporary fix.

@QuLogic QuLogic self-assigned this Sep 25, 2018
@QuLogic
Copy link
Member

QuLogic commented Sep 25, 2018

That docstring is outdated; other things are done in pcolormesh that are not workarounds.

QuLogic added a commit to QuLogic/cartopy that referenced this issue Sep 25, 2018
QuLogic added a commit to QuLogic/cartopy that referenced this issue Sep 26, 2018
NicWayand added a commit to NicWayand/polar.pangeo.io-deploy that referenced this issue Oct 10, 2018
QuLogic added a commit to QuLogic/cartopy that referenced this issue Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants