【发布时间】:2013-12-29 20:05:18
【问题描述】:
我正在尝试使我的 y 轴上的数字不重叠,如下图所示。我的代码使用 matplotlib 使用 plt.tight_layout() 命令一次绘制所有 8 个图。我不确定修复底部四个图中重叠的最佳方法是什么。
import matplotlib.pyplot as plt
fig = plt.figure()
a1 = fig.add_subplot(421)
a2 = fig.add_subplot(422)
a3 = fig.add_subplot(423)
a4 = fig.add_subplot(424)
a5 = fig.add_subplot(425)
a6 = fig.add_subplot(426)
a7 = fig.add_subplot(427)
a8 = fig.add_subplot(428)
a1.plot(Msol, ilP, color='blue')
a1.set_xlabel(r'$M/M\odot$')
a1.set_ylabel(r'$Log Pressure$')
a2.plot(Msol, ilT, color='blue')
a2.set_xlabel(r'$M/M\odot$')
a2.set_ylabel(r'$Log Temperature$')
a3.plot(Msol, ilRho, color='blue')
a3.set_xlabel(r'$M/M\odot$')
a3.set_ylabel(r'$Log Density$')
a4.plot(Msol, Rsol, color='blue')
a4.set_xlabel(r'$M/M\odot$')
a4.set_ylabel(r'$R/R\odot$')
a5.plot(Msol, Lsol, color='blue')
a5.set_xlabel(r'$M/M\odot$')
a5.set_ylabel(r'$L/L\odot$')
a6.plot(Msol, iK, color='blue')
a6.set_xlabel(r'$M/M\odot$')
a6.set_ylabel(r'$Opacity$')
a7.plot(Msol, ieg, color='blue')
a7.set_xlabel(r'$M/M\odot$')
a7.set_ylabel(r'$\epsilon$')
a8.plot(Msol, ir_c, color='blue')
a8.set_xlabel(r'$M/M\odot$')
a8.set_ylabel(r'$Convective Ratio$')
plt.tight_layout()
plt.show()
【问题讨论】:
标签: python matplotlib plot