ax.coastlines() produces empty plot #72

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

3 participants

@dmcdougall
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
SciTools 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

That is reasonable; it is consistent with matplotlib.

@pelson
SciTools member

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.

@pelson pelson closed this in 833f08b Oct 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment