【发布时间】:2021-02-22 20:28:15
【问题描述】:
我正在尝试为同一图中的三个图绘制线性最佳拟合线,以及它们各自的斜率和截距;我不知道该怎么做,所以它们都在我的数据中的同一张图中。有谁知道如何做到这一点? 我附上了一张图表如下所示的图片。
CSVfile_1 = 'Gas01_Fast.csv'
V_1, T_1, P_1, t_1 = getVTPt(filename='Gas01_Fast.csv')
CSVfile_2 = 'Gas02_Fast.csv'
V_2, T_2, P_2, t_2 = getVTPt(filename='Gas02_Fast.csv')
CSVfile_3 = 'Gas03_Fast.csv'
V_3, T_3, P_3, t_3 = getVTPt(filename='Gas03_Fast.csv')
fig, ax = plt.subplots()
ax.set_xlabel("Log(Volume)")
ax.set_ylabel("Log(Pressure)")
ax.set_title("Log(Pressure) vs Log(Volume)")
ax.errorbar(x=np.log10(V_1),y=np.log10(P_1),xerr=0,yerr=0,fmt='ro', ms=3)
ax.errorbar(x=np.log10(V_2),y=np.log10(P_2),xerr=0,yerr=0, fmt='bo', ms=3)
ax.errorbar(x=np.log10(V_3),y=np.log10(P_3),xerr=0,yerr=0, fmt='go', ms=3)
plt.legend(["Gas01_Fast.csv", "Gas02_Fast.csv","Gas03_Fast.csv"])
plt.show()
【问题讨论】:
标签: python numpy csv matplotlib