I am trying to plot position of several points (scatter plot) on a map using Cartopy (see code below). When I try to render the plot, data-points are rendered behind LAND-layer. But I want to plot my scatter-data over LAND-layer... What I am doing wrong?
Cartopy: ver. 0.12.x, Matplotlib: ver.1.4.2
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
ax = plt.axes(projection=ccrs.PlateCarree())
ax.set_extent([125, 150, 35, 63])
ax.stock_img()
ax.add_feature(cfeature.LAND) #If I comment this => all ok, but I need
ax.add_feature(cfeature.LAKES)
ax.add_feature(cfeature.RIVERS)
ax.coastlines()
ax.scatter(yc,xc,transform=ccrs.PlateCarree()) #yc, xc -- lists or numpy arrays
plt.show()
Most, if not all, matplotlib plotting functions take a zorder
parameter to specify the drawing order.
Lower zorder
s will be drawn first, and as such higher zorder
s will appear "on top".
So yeah, pass in zorder=xxx
to arrange your layers.
来源:https://stackoverflow.com/questions/26923673/cartopy-order-of-rendering-layers-with-scatter-data