首页 > 解决方案 > 具有不同 y 轴值的 Pandas 并排线图

问题描述

我正在绘制 3 个并排的线图:

data = df_chuck_from_db.groupby('day')['price'].agg(['min','max','mean'])
data.reset_index(inplace=True)

fig, (ax1, ax2, ax3) = plt.subplots(ncols=3, sharey=True, figsize=(16,6))

data.plot(x='day', y='mean', c='lightsteelblue', ax=ax1)
data.plot(x='day', y='max', c='lightsteelblue', ax=ax2)
data.plot(x='day', y='min', c='lightsteelblue', ax=ax3)

这给了我输出: 在此处输入图像描述

我想要实现的是: 在此处输入图像描述

可以将第一个图(平均值)上的 y 轴调整为与其他 2 个图不同吗?

标签: pythonpandasmatplotlibplot

解决方案


推荐阅读