如何叠加 pandas 图,matplotlib图和轴 [英] how to overlay a pandas plot, matplotlib plot, and axis

查看:73
本文介绍了如何叠加 pandas 图,matplotlib图和轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个情节,格式为:

I have one plot in the format:

df.plot()

另一个格式为:

fig,ax=plt.subplots()
ax.plot_date(t,y,'b-')

我无法将第一个图转换为标准的matplotlib图,因为它是从熊猫时间序列中重新采样的.

I cannot convert the first plot into the standard matplotlib plot because it is resampled from a pandas timeseries.

如何重叠两个图?

推荐答案

尝试df.plot(ax=ax).这将导致在提供的轴上绘制数据框对象.

Try df.plot(ax=ax). This causes the dataframe object to be plotted in the supplied axis.

这篇关于如何叠加 pandas 图,matplotlib图和轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆