diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/global_map.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/global_map.png deleted file mode 100644 index 947bab3ec..000000000 Binary files a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/global_map.png and /dev/null differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/multiple_projections5.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/multiple_projections5.png deleted file mode 100644 index ed1a48b51..000000000 Binary files a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/multiple_projections5.png and /dev/null differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/multiple_projections520.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/multiple_projections520.png deleted file mode 100644 index b6774e030..000000000 Binary files a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/multiple_projections520.png and /dev/null differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertI.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertI.png new file mode 100644 index 000000000..cc28fb49e Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertI.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertII.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertII.png new file mode 100644 index 000000000..242fdc26e Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertII.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertIII.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertIII.png new file mode 100644 index 000000000..544321351 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertIII.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertIV.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertIV.png new file mode 100644 index 000000000..139de25ce Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertIV.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertV.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertV.png new file mode 100644 index 000000000..d465fa40f Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertV.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertVI.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertVI.png new file mode 100644 index 000000000..d3a1aa4bf Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EckertVI.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EqualEarth.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EqualEarth.png new file mode 100644 index 000000000..f402d797c Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_EqualEarth.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Gnomonic.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Gnomonic.png new file mode 100644 index 000000000..8c7239dc7 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Gnomonic.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_InterruptedGoodeHomolosine.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_InterruptedGoodeHomolosine.png new file mode 100644 index 000000000..f42e00c5d Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_InterruptedGoodeHomolosine.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_LambertCylindrical.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_LambertCylindrical.png new file mode 100644 index 000000000..567a9ba28 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_LambertCylindrical.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Mercator.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Mercator.png new file mode 100644 index 000000000..4fcdf871c Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Mercator.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Miller.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Miller.png new file mode 100644 index 000000000..f70a2e0b9 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Miller.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Mollweide.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Mollweide.png new file mode 100644 index 000000000..ca5d415ab Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Mollweide.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_NorthPolarStereo.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_NorthPolarStereo.png new file mode 100644 index 000000000..f8d7f9d74 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_NorthPolarStereo.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_OSGB.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_OSGB.png new file mode 100644 index 000000000..d996a5138 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_OSGB.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Orthographic.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Orthographic.png new file mode 100644 index 000000000..3d1db2569 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Orthographic.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_PlateCarree.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_PlateCarree.png new file mode 100644 index 000000000..3e27509af Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_PlateCarree.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Robinson.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Robinson.png new file mode 100644 index 000000000..e702e37db Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Robinson.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_RotatedPole.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_RotatedPole.png new file mode 100644 index 000000000..2d13be288 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_RotatedPole.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_SouthPolarStereo.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_SouthPolarStereo.png new file mode 100644 index 000000000..580cad023 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_SouthPolarStereo.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Stereographic.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Stereographic.png new file mode 100644 index 000000000..e80fcd3c2 Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_Stereographic.png differ diff --git a/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_TransverseMercator.png b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_TransverseMercator.png new file mode 100644 index 000000000..f52365beb Binary files /dev/null and b/lib/cartopy/tests/mpl/baseline_images/mpl/test_mpl_integration/test_global_map_TransverseMercator.png differ diff --git a/lib/cartopy/tests/mpl/test_mpl_integration.py b/lib/cartopy/tests/mpl/test_mpl_integration.py index dea248ed1..367d46323 100644 --- a/lib/cartopy/tests/mpl/test_mpl_integration.py +++ b/lib/cartopy/tests/mpl/test_mpl_integration.py @@ -149,22 +149,6 @@ def test_global_hexbin_wrap_transform(): return ax.figure -@pytest.mark.mpl_image_compare(filename='global_map.png', tolerance=0.55) -def test_global_map(): - ax = plt.axes(projection=ccrs.Robinson()) -# ax.coastlines() -# ax.gridlines(5) - - ax.plot(-0.08, 51.53, 'o', transform=ccrs.PlateCarree()) - - ax.plot([-0.08, 132], [51.53, 43.17], color='red', - transform=ccrs.PlateCarree()) - - ax.plot([-0.08, 132], [51.53, 43.17], color='blue', - transform=ccrs.Geodetic()) - return ax.figure - - @pytest.mark.filterwarnings("ignore:Unable to determine extent") @pytest.mark.natural_earth @pytest.mark.mpl_image_compare(filename='simple_global.png') @@ -177,70 +161,54 @@ def test_simple_global(): @pytest.mark.filterwarnings("ignore:Unable to determine extent") @pytest.mark.natural_earth -@pytest.mark.mpl_image_compare(filename='multiple_projections5.png', - tolerance=2.05) -def test_multiple_projections(): - - projections = [ccrs.PlateCarree(), - ccrs.Robinson(), - ccrs.RotatedPole(pole_latitude=45, pole_longitude=180), - ccrs.OSGB(approx=True), - ccrs.TransverseMercator(approx=True), - ccrs.Mercator(min_latitude=-85., max_latitude=85.), - ccrs.LambertCylindrical(), - ccrs.Miller(), - ccrs.Gnomonic(), - ccrs.Stereographic(), - ccrs.NorthPolarStereo(), - ccrs.SouthPolarStereo(), - ccrs.Orthographic(), - ccrs.Mollweide(), - ccrs.InterruptedGoodeHomolosine(emphasis='land'), - ccrs.EckertI(), - ccrs.EckertII(), - ccrs.EckertIII(), - ccrs.EckertIV(), - ccrs.EckertV(), - ccrs.EckertVI(), - ] - - rows = np.ceil(len(projections) / 5).astype(int) - - fig = plt.figure(figsize=(10, 2 * rows)) - for i, prj in enumerate(projections, 1): - ax = fig.add_subplot(rows, 5, i, projection=prj) - - ax.set_global() - - ax.coastlines(resolution="110m") - - ax.plot(-0.08, 51.53, 'o', transform=ccrs.PlateCarree()) - ax.plot([-0.08, 132], [51.53, 43.17], color='red', - transform=ccrs.PlateCarree()) - ax.plot([-0.08, 132], [51.53, 43.17], color='blue', - transform=prj.as_geodetic()) - - return fig - - -@pytest.mark.natural_earth -@pytest.mark.mpl_image_compare(filename='multiple_projections520.png', - tolerance=0.641) -def test_multiple_projections_520(): - # Test projections added in Proj 5.2.0. +@pytest.mark.parametrize('proj', [ + ccrs.EckertI, + ccrs.EckertII, + ccrs.EckertIII, + ccrs.EckertIV, + ccrs.EckertV, + ccrs.EckertVI, + ccrs.EqualEarth, + ccrs.Gnomonic, + pytest.param((ccrs.InterruptedGoodeHomolosine, dict(emphasis='land')), + id='InterruptedGoodeHomolosine'), + ccrs.LambertCylindrical, + pytest.param((ccrs.Mercator, dict(min_latitude=-85, max_latitude=85)), + id='Mercator'), + ccrs.Miller, + ccrs.Mollweide, + ccrs.NorthPolarStereo, + ccrs.Orthographic, + pytest.param((ccrs.OSGB, dict(approx=True)), id='OSGB'), + ccrs.PlateCarree, + ccrs.Robinson, + pytest.param((ccrs.RotatedPole, + dict(pole_latitude=45, pole_longitude=180)), + id='RotatedPole'), + ccrs.Stereographic, + ccrs.SouthPolarStereo, + pytest.param((ccrs.TransverseMercator, dict(approx=True)), + id='TransverseMercator'), +]) +@pytest.mark.mpl_image_compare( + tolerance=(2.61 if MPL_VERSION.release[:2] == (3, 1) else + 0.97 if MPL_VERSION.release[:2] < (3, 5) else 0.5), + style='mpl20') +def test_global_map(proj): + if isinstance(proj, tuple): + proj, kwargs = proj + else: + kwargs = {} + proj = proj(**kwargs) fig = plt.figure(figsize=(2, 2)) - ax = fig.add_subplot(1, 1, 1, projection=ccrs.EqualEarth()) - + ax = fig.add_subplot(projection=proj) ax.set_global() - - ax.coastlines() + ax.coastlines(resolution="110m") ax.plot(-0.08, 51.53, 'o', transform=ccrs.PlateCarree()) - ax.plot([-0.08, 132], [51.53, 43.17], color='red', transform=ccrs.PlateCarree()) - ax.plot([-0.08, 132], [51.53, 43.17], color='blue', transform=ccrs.Geodetic())