将两个图合并为一个具有对数刻度的图 - 不同的数据框 pandas
Merge two plots into one with logarithmic scale - different data frames pandas
我想将接下来的两个图合并为一个对数标度的图。
df1.plot(x = 'Interval', y = 'Trend')
plt.yscale("log")
plt.show()
df2.plot(x = 'Value', y = 'Reliability')
plt.yscale("log")
plt.show()
如何合并这两个地块?
根据 documentation 你可以传入你想要绘制的坐标轴。因此,您的代码将变为:
fig, ax = plt.subplots()
df1.plot(x = 'Interval', y = 'Trend', ax=ax)
df2.plot(x = 'Value', y = 'Reliability', ax=ax)
ax.set_yscale("log")
plt.show()
我想将接下来的两个图合并为一个对数标度的图。
df1.plot(x = 'Interval', y = 'Trend')
plt.yscale("log")
plt.show()
df2.plot(x = 'Value', y = 'Reliability')
plt.yscale("log")
plt.show()
如何合并这两个地块?
根据 documentation 你可以传入你想要绘制的坐标轴。因此,您的代码将变为:
fig, ax = plt.subplots()
df1.plot(x = 'Interval', y = 'Trend', ax=ax)
df2.plot(x = 'Value', y = 'Reliability', ax=ax)
ax.set_yscale("log")
plt.show()