SciTools / cartopy

Cartopy - a cartographic python library with matplotlib support
https://scitools.org.uk/cartopy/docs/latest
BSD 3-Clause "New" or "Revised" License
1.41k stars 359 forks source link

matplotlib 2.0 #848

Closed marqh closed 7 years ago

marqh commented 7 years ago

The tests need to work with matplotlib 2.0 and the testing matrix needs to include matplotlib 2.0

as of #843 this is not the case

this was raised in #838 as part of the 0.15 release

the next release of Cartopy should be fully functional and tested w.r.t. matplotlib 2

QuLogic commented 7 years ago

See #773.

marqh commented 7 years ago

https://github.com/SciTools/cartopy/issues/838#issuecomment-277200907

debian are concerned about this

djkirkham commented 7 years ago

In Matplotlib 2.0 the default margin is 0.05 whereas in the old style there is no margin by default, although scatter plots (and perhaps others) do have a margin in both styles.

The default margin causes issues plotting maps; non-global plots have an ugly white area between the plot and the border, and global plots are smaller than before, and hovering off the edge of the map shows an extrapolation of the coordinates in the lower status bar.

Global plot:

>>> import matplotlib as mpl
>>> print mpl.__version__
2.0.0
>>> import matplotlib.pyplot as plt
>>> import cartopy.crs as ccrs
>>> x = np.arange(0, 361, 10)
>>> y = np.arange(-90, 91, 10)
>>> c = x[None,:-1] * y[:-1,None] 
>>> ax = plt.axes(projection=ccrs.PlateCarree())
>>> plt.pcolormesh(x, y, c)
<matplotlib.collections.QuadMesh object at 0x7f358c158710>
>>> ax.coastlines()
>>> plt.show()

extra

Non-global:

>>> ax = plt.axes(projection=ccrs.PlateCarree())
>>> plt.pcolormesh(x[4:9], y[4:9], c[4:8,4:8])
<matplotlib.collections.QuadMesh object at 0x7f358c18c410>
>>> ax.coastlines()
>>> plt.show()

non_global

QuLogic commented 7 years ago

MPL2 compatibility was added by #773.