Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CartoPy code gives attribute error #11966

Copy link
Copy link
Closed
@dopplershift

Description

@dopplershift
Issue body actions

The following code:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

proj = ccrs.LambertConformal()
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=proj)
ax.set_global()
ax.coastlines()
plt.show()

gives a traceback with 3.0.0rc2:

Traceback (most recent call last):
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/cartopy/mpl/geoaxes.py", line 1972, in <module>
    matplotlib.axes._subplots._subplot_classes[GeoAxes] = GeoAxesSubplot
AttributeError: module 'matplotlib.axes._subplots' has no attribute '_subplot_classes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_cartopy.py", line 6, in <module>
    ax = fig.add_subplot(1, 1, 1, projection=proj)
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/matplotlib/figure.py", line 1352, in add_subplot
    self, *args, **kwargs)
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/matplotlib/projections/__init__.py", line 83, in process_projection_requirements
    projection_class, extra_kwargs = projection._as_mpl_axes()
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/cartopy/crs.py", line 148, in _as_mpl_axes
    import cartopy.mpl.geoaxes as geoaxes
  File "/Users/rmay/miniconda3/envs/py36/lib/python3.6/site-packages/cartopy/mpl/geoaxes.py", line 1974, in <module>
    matplotlib.axes._subplot_classes[GeoAxes] = GeoAxesSubplot
AttributeError: module 'matplotlib.axes' has no attribute '_subplot_classes'

On 2.2.3 (and many versions before) it works fine.

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.