问题描述
我正在尝试使用以下内容创建2x2子图:
import geopandas as gpd
import matplotlib.pyplot as plt
import contextily as ctx
site = gdf.groupby('Site_name')
plt.figure(figsize =(20,20))
# Iterate through sites
for i,(Site_name,site_gdf) in enumerate(site):
# create subplot axes in a 2x2 grid
ax = plt.subplot(2,2,i + 1) # nrows,ncols,axes position
# plot the site on these axes
site_gdf.plot(ax=ax)
ctx.add_basemap(ax,source=ctx.providers.Esri.WorldImagery)
# set the title
ax.set_title(Site_name)
# set the aspect
# adjustable datalim ensure that the plots have the same axes size
ax.set_aspect('equal',adjustable='datalim')
plt.tight_layout()
plt.show()
会出现问题,即子图中的底图范围仅限于叠加点数据。如何更改它,以便每个子图都有一个覆盖整个子图的底图。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)