ax.twinx()。
import pandas as pdimport matplotlib.pyplot as pltdf = pd.Dataframe({"date": ["2018-01-01", "2018-01-02", "2018-01-03", "2018-01-04"], "column1": [555,525,532,585], "column2": [50,48,49,51]})ax = df.plot(x="date", y="column1", legend=False)ax2 = ax.twinx()df.plot(x="date", y="column2", ax=ax2, legend=False, color="r")ax.figure.legend()plt.show()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)