I’m trying to plot a figure of composite of extreme warming cases from CESM2 large ensemble climate data. I tried the following codes and it returned an incomplete world map.
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy
plt.figure(figsize=(12,10))
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=0))
level = [-60,-50,-40,-30,-20,-10,10,20,30,40,50,60]
ax.contour(lon, lat, z3_composite_mean - z3_djf_mean, levels=level,colors='k',transform=ccrs.PlateCarree())
But the codes below gave complete map!
level = np.arange(-60,60.1,10)
ax.contour(lon, lat, z3_composite_mean - z3_djf_mean, levels=level, colors='k',transform=ccrs.PlateCarree())
Or is it related to plotting coastlines with cartopy packages?
ax.add_feature(cartopy.feature.COASTLINE)
ax.add_feature(cartopy.feature.LAND, color='lightgrey')
Hope to figure out this confusing result, thanks!
I tried the contourf function, and the shading looks normal. Only contour plot suffers problem 🙁
New contributor
Jerry is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.