cartopy icon indicating copy to clipboard operation
cartopy copied to clipboard

Inconsistency drawing LAND/OCEAN cfeature for PolarStereo maps

Open blaylockbk opened this issue 1 year ago • 1 comments

Description

Hi all,

I wanted to report an inconsistency in adding features for the North/SouthPolarStereo maps.

I created a NorthPolarStereo map and added the LAND and OCEAN cfeatures. I was surprised that the LAND feature was not plotted.

import cartopy.feature as cfeature
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
ax = plt.axes(projection=ccrs.NorthPolarStereo())

ax.coastlines()
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.OCEAN)

image

It actually appears the LAND feature is drawn "under" the ocean. If I swap the order LAND and OCEAN are drawn, then I get what I expected on the right.

fig, (ax1, ax2) = plt.subplots(1,2, subplot_kw={'projection':ccrs.NorthPolarStereo()})

ax1.coastlines()
ax1.add_feature(cfeature.LAND)
ax1.add_feature(cfeature.OCEAN)
ax1.set_title('North ax1')

ax2.coastlines()
ax2.add_feature(cfeature.OCEAN) #<-- Swap order
ax2.add_feature(cfeature.LAND)
ax2.set_title('North ax2')

image

This behavior is inconsistent with adding these features on SouthPolarStereo, where it doesn't matter the order LAND and OCEAN are drawn; LAND is always on top of OCEAN. This is the behavior I expected NorthPolarStereo to also have.

fig, (ax1, ax2) = plt.subplots(1,2, subplot_kw={'projection':ccrs.SouthPolarStereo()})

ax1.coastlines()
ax1.add_feature(cfeature.LAND)
ax1.add_feature(cfeature.OCEAN)
ax1.set_title('South ax1')

ax2.coastlines()
ax2.add_feature(cfeature.OCEAN) #<-- Swap order
ax2.add_feature(cfeature.LAND)
ax2.set_title('South ax2')

image

Cartopy version 0.21.1

Matplotlib version 3.7.1

blaylockbk avatar Mar 20 '23 22:03 blaylockbk

(of course, after I posted this I found someone else reported this in another issue...https://github.com/SciTools/cartopy/issues/1674)

blaylockbk avatar Mar 20 '23 22:03 blaylockbk