我有以下代码:
fig = plt.figure()
ax1 = plt.subplot(211)
ax2 = plt.subplot(212, sharex = ax1)
ax2 = ax1.twinx()
num = list111.lt(-90).sum(1)
plt.yticks(fontsize = 25)
ax = num.plot(figsize=(45,25), ax=ax2, color = 'Red')
df2.plot(y = 'Close', figsize=(45,25), ax=ax1, color = 'Green')
ax1.grid()
ax.margins(x=0)
我试图在同一个图表中绘制ax1和ax2。我得到的是一个鬼阴谋:
如何摆脱第二个重影打印并将带有标签的x轴移动到顶部打印
声明
生成位于
ax1
子地块下方的子地块。但这与声明相矛盾指向
ax1
轴上的次y轴如果希望所有数据仅绘制在单个轴上,可以删除第一条语句并使用
.twinx()
方法:否则,将两个轴分别与一起使用
相关问题 更多 >
编程相关推荐