您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

在Matplotlib中定位5个子图

在Matplotlib中定位5个子图

您可以在使用suplot2grid而不是subplot时使用colspan。

import matplotlib.pyplot as plt

ax1 = plt.subplot2grid(shape=(2,6), loc=(0,0), colspan=2)
ax2 = plt.subplot2grid((2,6), (0,2), colspan=2)
ax3 = plt.subplot2grid((2,6), (0,4), colspan=2)
ax4 = plt.subplot2grid((2,6), (1,1), colspan=2)
ax5 = plt.subplot2grid((2,6), (1,3), colspan=2)

然后,每个子图都需要2个cols宽,以便第二行中的子图可以移动1列。

其他 2022/1/1 18:29:18 有435人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶