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

ax.coastlines() produces empty plot #72

Closed
dmcdougall opened this issue Oct 5, 2012 · 3 comments
Closed

ax.coastlines() produces empty plot #72

dmcdougall opened this issue Oct 5, 2012 · 3 comments
Milestone

Comments

@dmcdougall
Copy link
Contributor

In [1]: import matplotlib

In [2]: matplotlib.use('gtkagg')

In [3]: import cartopy.crs as ccrs

In [4]: import matplotlib.pyplot as plt

In [5]: ax = plt.axes(projection=ccrs.Mercator())

In [6]: ax.coastlines()

In [7]: plt.show()

Here's sample output:

output

I have tried both the Mercator and Orthographic projections, the result is the same in both cases.

@rhattersley
Copy link
Member

That's explainable... Cartopy maps automatically change their extent based on the data added (just like regular matplotlib axes)... but coastlines don't count (otherwise every time you added coastlines the map would switch to being global.)

Try adding ax.set_global()

Now it might be explainable... but is it reasonable or desirable?

@dmcdougall
Copy link
Contributor Author

That is reasonable; it is consistent with matplotlib.

@pelson
Copy link
Member

pelson commented Oct 5, 2012

Thanks for pointing it out.
My next trick is to automatically do global if no data has been added to the plot. I think this is perfectly achievable and would make a lot more sense than the current behaviour!

Cheers.

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

3 participants