如何使用 pysal 或 geopandas 并排绘制两张地图?
How to plot two maps side by side using pysal or geopandas?
我想并排绘制两个主题图进行比较。我正在使用 geopandas 绘制地图,使用 pysal 从空间分析生成地图。
您可以使用matplotlib创建子图结构,然后将带有geopandas/pysal的图添加到特定的子图中:
import matplotlib.pyplot as plt
fig, axes = plt.subplots(ncols=2)
# add geopandas plot to left subplot
geodataframe.plot(..., ax=axes[0])
# add pysal plot to right subplot using `axes[1]`
为了得到并排的两张geopandas地图,你可以这样写:
fig, (ax1,ax2) = plt.subplots(nrows=1, ncols=2, figsize=(20, 16))
ax1 = geodataframe.plot(ax=ax1, column='obs', legend=True)
ax2 = geodataframe.plot(ax=ax2, column='pred', legend=True)
我想并排绘制两个主题图进行比较。我正在使用 geopandas 绘制地图,使用 pysal 从空间分析生成地图。
您可以使用matplotlib创建子图结构,然后将带有geopandas/pysal的图添加到特定的子图中:
import matplotlib.pyplot as plt
fig, axes = plt.subplots(ncols=2)
# add geopandas plot to left subplot
geodataframe.plot(..., ax=axes[0])
# add pysal plot to right subplot using `axes[1]`
为了得到并排的两张geopandas地图,你可以这样写:
fig, (ax1,ax2) = plt.subplots(nrows=1, ncols=2, figsize=(20, 16))
ax1 = geodataframe.plot(ax=ax1, column='obs', legend=True)
ax2 = geodataframe.plot(ax=ax2, column='pred', legend=True)