如何解决用数据限制进行绘图Python
我想要这样的图,我不确定如何在Y轴上设置UL和LL,如下图所示 enter image description here
请帮助设置限制,我使用海运包装。
解决方法
这有效:
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
plt.figure()
plt.plot([30,50,20,10,60])
plt.ylim((-100,100))
,
此图表称为控制图,可以使用库pyspc
来完成,并使用pip install pyspc
安装它
您可以添加这两行以显示一个限制
horiz_line_data = nnp.array([5 for i in range(len(x))])
plt.plot(x,horiz_line_data,'r--')
这是示例代码
import matplotlib.pyplot as plt
import numpy as nnp
import seaborn as sns
from pyspc import *
sns.set()
plt.figure()
plt.plot([30,60])
x = [0,1,2,3,4]
LL=5
UL=75
horiz_line_data = nnp.array([LL for i in range(len(x))])
plt.plot(x,'r--')
horiz_line_data = nnp.array([UL for i in range(len(x))])
plt.plot(x,'r--')
plt.ylim((-10,90))
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。