我的绘图代码如下:
ax30 = df5.plot(kind="scatter", x='Data Numbers', y='y', color="red", label="67890")
ax33 = ax30.twinx()
df8.plot(kind="scatter", x='Data Numbers', y='y', color="blue", label="12345", ax=ax33, secondary_y = True)
ax30.set_ylabel("A")
ax33.set_ylabel("B")
ax30.set_xlabel("C")
ax30.set_title("DDD")
ax30.set_xlim([0,150])
ax30.set_ylim([0,40000])
ax33.set_xlim([0,150])
ax33.set_ylim([0,40000])
我试图用两个不同的y轴绘制一个数据,但似乎图例是重叠的。我怎样才能克服这个问题,把图例重新组合起来呢?目前的数字如下:
代码的当前结果数字
此解决方案应垂直堆叠标签,消除任何重叠:
相关问题 更多 >
编程相关推荐