石川图(Ishikawa Diagram):一种实用的质量管理工具
创作时间:
作者:
@小白创作中心
石川图(Ishikawa Diagram):一种实用的质量管理工具
引用
CSDN
1.
https://m.blog.csdn.net/wh1t3zztjn/article/details/142265177
石川图(Ishikawa Diagram),也称为鱼骨图、人字形图或因果图,是由石川薰创建的因果图,用于显示特定事件的潜在原因。基本概念于 1920 年代首次使用,被认为是质量控制的七种基本工具之一。它因其形状而被称为鱼骨图,类似于鱼骨架的侧视图。
石川图的常见用途是产品设计质量缺陷预防,以确定导致整体效果的潜在因素。不完美的每个原因或原因都是变化的来源。原因通常分为主要类别,以识别和分类这些变异来源。马自达汽车在开发 Miata (MX5) 跑车时使用了石川图。
接下来,我们通过Python代码展示如何绘制石川图:
import math
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon, Wedge
fig, ax = plt.subplots(figsize=(10, 6), layout='constrained')
ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5)
ax.axis('off')
def problems(data: str,
problem_x: float, problem_y: float,
angle_x: float, angle_y: float):
"""
Draw each problem section of the Ishikawa plot.
Parameters
----------
data : str
问题类别的名称。
problem_x, problem_y : float, optional
问题箭头的`X`和`Y`位置(`Y`默认为零)。
angle_x, angle_y : float, optional
问题注释的角度。它们总是朝向图表尾部倾斜。
Returns
-------
None.
"""
'使用 annotate 方法添加文本和箭头。'
ax.annotate(str.upper(data), xy=(problem_x, problem_y),
xytext=(angle_x, angle_y),
fontsize=10,
color='white',
weight='bold',
xycoords='data',
verticalalignment='center',
horizontalalignment='center',
textcoords='offset fontsize',
arrowprops=dict(arrowstyle="->", facecolor='black'),
bbox=dict(boxstyle='square',
facecolor='tab:blue',
pad=0.8))
def causes(data: list,
cause_x: float, cause_y: float,
cause_xytext=(-9, -0.3), top: bool = True):
"""
Place each cause to a position relative to the problems
annotations.
Parameters
----------
data : indexable object
可索引对象,输入数据。如果传递了超过六个参数,会引发 IndexError。
cause_x, cause_y : float
表示原因注释的 X 和 Y 位置
cause_xytext : tuple, optional
用于调整原因文本与问题箭头之间的距离,以字号单位表示。
top : bool, default: True
决定下一个原因注释是绘制在前一个注释的上方还是下方。
Returns
-------
None.
"""
'使用 enumerate 遍历 data 列表中的每个原因'
for index, cause in enumerate(data):
# [<x pos>, <y pos>]
coords = [[0.02, 0],
[0.23, 0.5],
[-0.46, -1],
[0.69, 1.5],
[-0.92, -2],
[1.15, 2.5]]
# First 'cause' annotation is placed in the middle of the 'problems' arrow
# and each subsequent cause is plotted above or below it in succession.
#首先将“原因”注释放置在“问题”箭头的中间,然后依次在其上方或下方绘制每个后续的原因。
cause_x -= coords[index][0]
cause_y += coords[index][1] if top else -coords[index][1]
ax.annotate(cause, xy=(cause_x, cause_y),
horizontalalignment='center',
xytext=cause_xytext,
fontsize=9,
xycoords='data',
textcoords='offset fontsize',
arrowprops=dict(arrowstyle="->",
facecolor='black'))
def draw_body(data: dict):
"""
Place each problem section in its correct place by changing
the coordinates on each loop.
Parameters
----------
data : dict
输入数据(可以是列表或元组的字典)。如果传递了超过六个参数,会引发 ValueError。
Returns
-------
None.
"""
# Set the length of the spine according to the number of 'problem' categories.
#根据“问题”类别的数量设置脊柱的长度
length = (math.ceil(len(data) / 2)) - 1
draw_spine(-2 - length, 2 + length)
# Change the coordinates of the 'problem' annotations after each one is rendered.
#在每个问题注释渲染后,改变其坐标。
offset = 0
prob_section = [1.55, 0.8]
for index, problem in enumerate(data.values()):
plot_above = index % 2 == 0
cause_arrow_y = 1.7 if plot_above else -1.7
y_prob_angle = 16 if plot_above else -16
# Plot each section in pairs along the main spine.
#沿着主脊柱成对地绘制每个部分。
prob_arrow_x = prob_section[0] + length + offset
cause_arrow_x = prob_section[1] + length + offset
if not plot_above:
offset -= 2.5
if index > 5:
raise ValueError(f'Maximum number of problems is 6, you have entered '
f'{len(data)}')
problems(list(data.keys())[index], prob_arrow_x, 0, -12, y_prob_angle)
causes(problem, cause_arrow_x, cause_arrow_y, top=plot_above)
def draw_spine(xmin: int, xmax: int):
"""
Draw main spine, head and tail.
Parameters
----------
xmin : int
脊柱头部的默认 x 坐标位置。
xmax : int
脊柱尾部的默认 x 坐标位置。
Returns
-------
None.
"""
# draw main spine
ax.plot([xmin - 0.1, xmax], [0, 0], color='tab:blue', linewidth=2)
# draw fish head
ax.text(xmax + 0.1, - 0.05, 'PROBLEM', fontsize=10,
weight='bold', color='white')
semicircle = Wedge((xmax, 0), 1, 270, 90, fc='tab:blue')
ax.add_patch(semicircle)
# draw fish tail
tail_pos = [[xmin - 0.8, 0.8], [xmin - 0.8, -0.8], [xmin, -0.01]]
triangle = Polygon(tail_pos, fc='tab:blue')
ax.add_patch(triangle)
# Input data
categories = {
'Method': ['Time consumption', 'Cost', 'Procedures', 'Inefficient process',
'Sampling'],
'Machine': ['Faulty equipment', 'Compatibility'],
'Material': ['Poor-quality input', 'Raw materials', 'Supplier',
'Shortage'],
'Measurement': ['Calibration', 'Performance', 'Wrong measurements'],
'Environment': ['Bad conditions'],
'People': ['Lack of training', 'Managers', 'Labor shortage',
'Procedures', 'Sales strategy']
}
draw_body(categories)
plt.show()
通过这段代码,我们可以绘制出一个完整的石川图,帮助我们更好地理解和分析问题的原因和影响因素。
热门推荐
R语言绘图入门:基础绘图与ggplot2详解
市场失灵的原因和表现是什么
智能AI辅助CT报告快速识别与分析:全面优化医学影像诊断流程
元胞自动机模拟晶粒生长及熔池演变——枝晶与晶粒合金凝固模拟
新能源车企供应链指南:如何应对冲突矿产风险
科学防流感 健康常相伴
中药怎么煎才是正确的
永磁体:从古希腊磁石到现代科技的应用
构建具有丝绸之路特色的现代博物馆体系——甘肃10家国家一级博物馆探访
低头族请注意!小心颈椎病找上你
解释复杂学术概念的5个实用技巧
构建数据库的最佳实践:设计、管理与优化技巧汇总
房屋安全性鉴定收费标准及法律法规解析
业绩下滑仍扩产,璞泰来打的什么算盘?
恋爱爱情婚姻三者的关系
资产优化的方法有哪些?资产优化的目标是什么?
银行的外汇兑换手续费高吗?
王者荣耀扁鹊出装攻略:从核心装备到实战应用
龙珠、超级赛亚人 1 - 3 战力数据对比
如何开始从基础培养写作能力(写作打下坚实基础的方法)
看“补给神器”如何施展空战神助攻
中日生死观大不同:中国人“惧死”,日本人却与死人“共生”
人死后会去哪里?科学家认为,人死后灵魂去了宇宙
嫦娥奔月神话新解:嫦娥与后羿的关系竟是这样演变的
大数据分析 “技术流”赋能 金融助力科创企业崛起
透明桥接技术在MEC中的实现与优化
甲状腺结节能吃蜂蜜吗
新房通风时间及注意事项
活火山富士山,怎么成了日本的象征
提高记笔记速度的方法小技巧