如何在多个时间序列图像上绘制矢量图

How to plot a vector map on multiple time series image

我有每月平均 LMK xarray 数据集(总共 12 张图像,每个月一张图像),它是用下面的代码绘制的。我想绘制 shapefile.shp 并叠加在每个图像上。

fig, ax = plt.subplots(figsize=(5, 5))

lmk_plot = monthly_df.lmk.plot(figsize = (15, 30), col = "month", col_wrap = 3, cmap=cmap,
                     norm=norm, robust=True, cbar_kwargs={
        "orientation": "horizontal",
        "label": "custom label",
        "shrink": 0.5,
        "aspect": 20,
        "pad": 0.03,
        "label": "Mean LMK [%]",
    })
lmk_plot.set_titles(size = 18)
scalebar = ScaleBar(25, location = 'lower right', length_fraction = 0.25) # 1 pixel = 0.2 meter
plt.gca().add_artist(scalebar)
plt.show()

非常感谢任何帮助。

以下代码完成了工作:

import geopandas as gpd

sf_lmk = gpd.read_file('shapefile.shp')
lmk_plot = monthly_lmk.plot(figsize = (15, 30), col = "month", col_wrap = 3, cmap=cmap,
                     norm=norm, robust=True, cbar_kwargs={
        "orientation": "horizontal",
        "label": "custom label",
        "shrink": 0.5,
        "aspect": 20,
        "pad": 0.03,
        "label": "Mean LMK [%]",
    })
for i, ax in enumerate(lmk_plot.axes.flat):
    sf_lmk.plot(ax=ax, color=None, alpha = 1, edgecolor='black', linewidth = 2)
lmk_plot.set_titles(size = 18)
scalebar = ScaleBar(25, location = 'lower right', length_fraction = 0.25) # 1 pixel = 0.2 meter
plt.gca().add_artist(scalebar)
plt.show()