python - 使用数据限制绘图(python)
解决方案
该图表称为控制图,可以使用库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, 50, 20, 10, 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, horiz_line_data, 'r--')
horiz_line_data = nnp.array([UL for i in range(len(x))])
plt.plot(x, horiz_line_data, 'r--')
plt.ylim((-10, 90))
推荐阅读
- powershell - Edge Chromium 是否有类似于 Internet Explorer 提供的 COM 接口?
- python - 在与 Python 中的用户输入匹配的列表列表中操作列表?
- asp.net-core - 为什么 DistributedCache SessionHandler 会抛出连接问题?
- html - 子页面的不同 CSS 不加载
- powerbi - Power Query / Power BI - 如何以最简单的方式将单元格值移动到单独的单元格?
- javafx - 用我自己的 textfeild 替换日期选择器文本字段
- regex - 匹配 URL 路径和子项
- dart - 对不可为空的变量使用 late 关键字有什么好处?
- java - LinkedMultiValueMap SpringFramework 未迭代(错误:无法转换为类)
- database - mysql 连接器在故障转移到从属设备后无法回退到主控设备