我有一个matplotlib图,实际上是两个高度不同的子图,看起来像是一个不连贯的图。在
我用Gridspec做了这个:
outer = gridspec.GridSpec(2, 1, height_ratios=[1,3])
gs1 = gridspec.GridSpecFromSubplotSpec(1, 1, subplot_spec = outer[0])
ax1 = plt.subplot(gs1[0])
ax1.plot(no_rot,max_sd,'k*')
plt.ylabel('Y Axis Label')
gs2 = gridspec.GridSpecFromSubplotSpec(1, 1, subplot_spec = outer[1])
ax2 = plt.subplot(gs2[0])
ax2.plot(no_rot,max_sd,'k*')
plt.xlabel('X Axis Label')
plt.ylabel('Y Axis Label')
我现在只想有一个共享的,集中的Y轴标签,但我不知道怎么做。在
您可以尝试使用以下内容存储对标签的引用:
然后改变它的相对位置
^{pr2}$您可能需要调整相对(x,y)来正确定位它,因为您有两个子批次。在
或者,在地物中明确地放置子地块,并相对于地物坐标放置y轴的文本标签:
相关问题 更多 >
编程相关推荐