如何添加跨越两个子图的X标签?其次,我如何调整我的X轴索引使用子图b/c xticks或set_xticklabels似乎不能正确显示?如果有帮助,我可以提供数据集。我以为我正确地使用了subplot命令。

x1 = np.r_[50:64]
x2 = np.r_[89:103]
fig, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
#Left plot
ax1.plot(x1,left[0],color='red',marker="o",label=r'$\alpha$PV Ca$^{2+}$',linestyle='dashed',markersize=6)
ax1.plot(x1,left[1],color='blue',marker="o",label=r'$\alpha$PV Mg$^{2+}$',linestyle='dashed',markersize=6)
ax1.plot(x1,left[2],color='red',marker="o",label=r'$\alpha$PV S55D/E59D Ca$^{2+}$',linestyle='solid',linewidth='6',markersize=10)
ax1.plot(x1,left[3],color='blue',marker="o",label=r'$\alpha$PV S55D/E59D Mg$^{2+}$',linestyle='solid',linewidth='6',markersize=10)
ax1.plot(x1,left[4],color='red',marker="o",label=r'$\alpha$PV D94S/G98E Ca$^{2+}$',linestyle='solid',linewidth='1',markersize=6)
ax1.plot(x1,left[5],color='blue',marker="o",label=r'$\alpha$PV D94S/G98E Mg$^{2+}$',linestyle='solid',linewidth='1',markersize=6)
#Right plot
ax2.plot(x2,right[0],color='red',marker="o",label=r'$\alpha$PV Ca$^{2+}$',linestyle='dashed',markersize=6)
ax2.plot(x2,right[1],color='blue',marker="o",label=r'$\alpha$PV Mg$^{2+}$',linestyle='dashed',markersize=6)
ax2.plot(x2,right[2],color='red',marker="o",label=r'$\alpha$PV S55D/E59D Ca$^{2+}$',linestyle='solid',linewidth='6',markersize=10)
ax2.plot(x2,right[3],color='blue',marker="o",label=r'$\alpha$PV S55D/E59D Mg$^{2+}$',linestyle='solid',linewidth='6',markersize=10)
ax2.plot(x2,right[4],color='red',marker="o",label=r'$\alpha$PV D94S/G98E Ca$^{2+}$',linestyle='solid',linewidth='1',markersize=6)
ax2.plot(x2,right[5],color='blue',marker="o",label=r'$\alpha$PV D94S/G98E Mg$^{2+}$',linestyle='solid',linewidth='1',markersize=6)
ax1.legend(fontsize=14,handlelength=2,loc="best")
ax1.set_ylabel('Contribution Energy (kcal/mol)', fontsize=25)
ax1.tick_params(axis='both', which='major', labelsize=28, length=9, width=4)
ax2.tick_params(axis='x', which='major', labelsize=28, length=9, width=4)
plt.tight_layout()
plt.suptitle('\u03B1PV WT and Mutants',fontsize=35)
plt.subplots_adjust(top=.90)https://stackoverflow.com/questions/50766326
复制相似问题