如何结合matplotlib图?
导入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']);
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']);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论