proplot-dev / proplot

🎨 A succinct matplotlib wrapper for making beautiful, publication-quality graphics
https://proplot.readthedocs.io
MIT License
1.07k stars 96 forks source link

incomaptible with cartopy 0.21.X? #418

Open beckermr opened 1 year ago

beckermr commented 1 year ago

Description

I cannot get the geo axes to work with cartopy 0.21.X. I see the ci is pinned at 0.20.X which is probably why you have not seen this. We should add a run constrained entry to the conda-forge package.

Error is "AttributeError: '_CartopyAxesSubplot' object has no property 'map_projection'"

Steps to reproduce

A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you.

# your code here
# we should be able to copy-paste this into python and exactly reproduce your bug
fig, axs = pplt.subplots(nrows=3, ncols=2, share=0, proj={(1, 3, 5): "cartopy"})

# plot something here

Expected behavior: [What you expected to happen]

Actual behavior: [What actually happened]

Equivalent steps in matplotlib

Please try to make sure this bug is related to a proplot-specific feature. If you're not sure, try to replicate it with the native matplotlib API. Matplotlib bugs belong on the matplotlib github page.

# your code here, if applicable
import matplotlib.pyplot as plt

Proplot version

Paste the results of import matplotlib; print(matplotlib.__version__); import proplot; print(proplot.version) here.

3.4.3 0.9.7

lukelbd commented 1 year ago

Thanks for the report. I'll also do another minor release on the v0.9.6 branch to enforce cartopy < 0.21.0 (I wish we could just change the requirements for existing pypi releases like with conda...).

Note that this seems to be a little improved on the master branch; I just get a deprecation warning instead of an error:

fig, axs = pplt.subplots(nrows=3, ncols=2, share=0, proj={(1, 3, 5): 'robin'})
axs[:, 0].format(labels=True, land=True)
axs[0].contourf(np.linspace(-180, 180, 5), np.linspace(-90, 90, 5), np.random.rand(5, 5))

Result:

/Users/ldavis/mambaforge/envs/proplot-dev/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py:406: UserWarning: The `map_projection` keyword argument is deprecated, use `projection` to instantiate a GeoAxes instead.
  warnings.warn("The `map_projection` keyword argument is "
/Users/ldavis/mambaforge/envs/proplot-dev/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py:406: UserWarning: The `map_projection` keyword argument is deprecated, use `projection` to instantiate a GeoAxes instead.
  warnings.warn("The `map_projection` keyword argument is "
/Users/ldavis/mambaforge/envs/proplot-dev/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py:406: UserWarning: The `map_projection` keyword argument is deprecated, use `projection` to instantiate a GeoAxes instead.

iTerm2 ISFPFz tmp8fdos1ow