如何结合matplotlib图?

发布于 2025-02-08 00:17:37 字数 1288 浏览 0 评论 0原文

导入LAPTOP_DEFECT文件后,我绘制了3个图表,用于1)随着时间的流逝,缺陷2)随着时间的流逝3)随着时间的流逝,缺陷率随时间限制。 我想知道如何将所有3个图组合在1图中?

到目前为止,这是我到目前为止的:

import pandas as pd
laptop_defects = pd.read_excel('/content/Data_Analysis_Project.xlsx')
laptop_defects
import matplotlib.pyplot as plt
plt.plot(laptop_defects.Defects)
plt.plot(laptop_defects.Opportunities)

计算缺陷率

laptop_defects['Defect Rate'] = round(laptop_defects['Defects']/ laptop_defects['Opportunities'] * 1000000,0)
laptop_defects.head()

plt.plot(laptop_defects ['Month ID(YYYYMM)'], laptop_defects['Defect Rate']);
plt.plot(laptop_defects ['Month ID(YYYYMM)'], laptop_defects['Mean Rate']);
plt.plot(laptop_defects ['Month ID(YYYYMM)'], laptop_defects['2 Sigma limit']);
plt.plot(laptop_defects ['Month ID(YYYYMM)'], laptop_defects['3 Sigma limit']);

”缺陷graph“

“机会图”

After importing the laptop_defect file, I plotted 3 graphs for 1) Defects over time 2) Opportunities over time 3) defect rate with mean rate and limits over time.
I was wondering how can I combine all 3 graphs in 1 figure?

Here's what I have so far:

import pandas as pd
laptop_defects = pd.read_excel('/content/Data_Analysis_Project.xlsx')
laptop_defects
import matplotlib.pyplot as plt
plt.plot(laptop_defects.Defects)
plt.plot(laptop_defects.Opportunities)

Calculate Defect Rate

laptop_defects['Defect Rate'] = round(laptop_defects['Defects']/ laptop_defects['Opportunities'] * 1000000,0)
laptop_defects.head()

plt.plot(laptop_defects ['Month ID(YYYYMM)'], laptop_defects['Defect Rate']);
plt.plot(laptop_defects ['Month ID(YYYYMM)'], laptop_defects['Mean Rate']);
plt.plot(laptop_defects ['Month ID(YYYYMM)'], laptop_defects['2 Sigma limit']);
plt.plot(laptop_defects ['Month ID(YYYYMM)'], laptop_defects['3 Sigma limit']);

Defects Graph

Opportunities Graph

Defect rate with mean rate and limits over time

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文