Skip to content

Global map cropped with pcolormesh when lats > 90 #1947

@fmaussion

Description

@fmaussion

Here is a mwe:

import matplotlib
import matplotlib.pyplot as plt
import numpy as np 
import cartopy
import cartopy.crs as ccrs  

print('matplotlib', matplotlib.__version__)
print('cartopy', cartopy.__version__)

lon = np.linspace(-179.625, 179.625, 480)
lat = np.linspace(90, -90, 241)
data, _ = np.meshgrid(lon, lat)

plt.figure()
ax = plt.axes(projection=ccrs.EqualEarth())
plt.pcolormesh(lon, lat, data, transform=ccrs.PlateCarree(), shading='nearest')
ax.coastlines(); ax.gridlines();

Which produces:
image

Strangely enough, this does not occur with other coordinates (here in steps of 1):

lon = np.linspace(-180, 180, 361)
lat = np.linspace(90, -90, 181)
data, _ = np.meshgrid(lon, lat)

plt.figure()
ax = plt.axes(projection=ccrs.EqualEarth())
plt.pcolormesh(lon, lat, data, transform=ccrs.PlateCarree(), shading='nearest')
ax.coastlines(); ax.gridlines();

image

This is:

matplotlib 3.4.3
cartopy 0.20.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions