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

Convoluted pylab crash - interaction with label/figure management triggered by cartopy #13184

Open
fperez opened this issue Oct 12, 2021 · 4 comments

Comments

@fperez
Copy link
Member

fperez commented Oct 12, 2021

I'm not yet sure where exactly this bug is coming from - I've only seen it triggered from using cartopy, and I'm not sure yet whether it's in our core/pylabtools or in matplotlib itself. It also only manifests itself in the notebook - the same exact code works just fine in terminal IPython...

In any case - on to the bug: the following code

# BUG: if auto_update is True, this code crashes in the notebook
auto_update = True
#auto_update = False

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

fig, ax = plt.subplots(subplot_kw=dict(projection=ccrs.PlateCarree()))
ax.coastlines()
ax.gridlines(draw_labels=True, auto_update=auto_update);

when auto_update is true, produces the traceback below (collapsed for brevity).

(pasting the traceback as an image as it's more readable)

When False, the code works as expected, producing this figure:

image

We may need to move this over to matplotlib, or even cartopy - just starting here before I lose track so at least we have it filed.

@fperez
Copy link
Member Author

fperez commented Oct 12, 2021

Quick ping to @dopplershift in case you or others on cartopy have any thoughts - happy to work on a fix on our end if that's the case, but I'm wondering if it's something either in cartopy or mpl... (btw - loving cartopy, thx!!!)

@dopplershift
Copy link
Contributor

My current guess is that it's an issue in cartopy? By no means sure, but it feels like there's something going on with how the gridlines are being initialized--weird that self.figure (for a Text instance is None) at that point.

@fperez
Copy link
Member Author

fperez commented Oct 12, 2021

Thanks for pitching in Ryan! It would be nice to get it fixed -I realized that with the label auto-update and the widget mpl backend, cartopy makes interactive map navigations absolutely trivial, while keeping all the map lat/lon info updated. It's really cool (obviously not super fast due to the roundtrips mandated by the architecture, but it does get the job done), but unfortunately this little bug does break that nice use case.

If you think there's anything on the IPtyhon mpl support that is causing this we're happy to look into it, but I'd be surprised...

@dopplershift
Copy link
Contributor

@fperez I'm swamped at the moment, but if you could open this up as an issue over on the cartopy issue tracker it might get some traction from someone with some time. 😉

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

2 participants