我有一个DataFrame,我想在一个图中绘制它的两列。我的代码如下:
x = df_Data_7370(start_date, end_date)
fig, ax = plt.subplots(figsize=(5,5))
x.plot(x="Diff_Rollkreis", y="Beugemoment", yticks=[0,2,4,6,8,10],
xlabel='Diff. Rollkreis-Ø [mm]', ylabel='Beugemoment [Nm]', style='o', color='red', markersize=2, ax=ax)
x.plot(x="Diff_Rollkreis", y="Axialspiel", style='o', color='blue', markersize=2, ax=ax, secondary_y=True)
canvas = FigureCanvasTkAgg(fig, master = master)
canvas.get_tk_widget().place(x=235,y=0)
canvas.draw()
我的问题是-我不知道如何命名第二个y轴-我不知道如何设置主轴和第二个轴的ylim和yticks。我怎么能说python,主轴和第二个轴的ylim和yticks是不同的?
谢谢你帮助
x = df_Data_7370(start_date, end_date)
fig, ax = plt.subplots(figsize=(5,5))
x.plot(x="Diff_Rollkreis", y="Beugemoment", yticks=[0,2,4,6,8,10], xlabel='Diff. Rollkreis-Ø [mm]', ylabel='Beugemoment [Nm]', style='o', color='red', markersize=2, ax=ax)
x.plot(x="Diff_Rollkreis", y="Axialspiel", style='o', color='blue', markersize=2, ax=ax, secondary_y=True)
canvas = FigureCanvasTkAgg(fig, master = master)
canvas.get_tk_widget().place(x=235,y=0)
canvas.draw()
1条答案
按热度按时间tct7dpnv1#
下面是具有两个y轴的图的示例:
结果是: