cartopy
cartopy copied to clipboard
Inconsistency drawing LAND/OCEAN cfeature for PolarStereo maps
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)
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')
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')
Cartopy version 0.21.1
Matplotlib version 3.7.1
(of course, after I posted this I found someone else reported this in another issue...https://github.com/SciTools/cartopy/issues/1674)