Skip to content

Inconsistency drawing LAND/OCEAN cfeature for PolarStereo maps #2160

@blaylockbk

Description

@blaylockbk

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions