如何在matplotlib中绘制斑纹样式轴

2024-03-29 09:41:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在zebra style中绘制轴,如下所示:

Zebra border axis

下面是我的代码:

import matplotlib.pyplot as plt
import cartopy.io.shapereader as shpreader
import cartopy.crs as ccrs
from cartopy.feature  import ShapelyFeature

fig, ax = plt.figure(figsize=(12,9),  dpi=150 )
sFilename_shapefile = './some_shape.shp'
pShapeReader = shpreader.Reader(sFilename_shapefile)
pProjection_map = ccrs.PlateCarree()
aShapeFeature = ShapelyFeature(pShapeReader.geometries(), 
  pProjection_map, facecolor='grey', edgecolor='grey', 
  linewidth=0.5)
ax.add_feature(aShapeFeature, zorder = 4)
plt.show()

我得到的是这样的:

Normal border axis


Tags: importmapaspltaxfeatureshapefilecartopy