石川图(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()
通过这段代码,我们可以绘制出一个完整的石川图,帮助我们更好地理解和分析问题的原因和影响因素。
热门推荐
长平之战:廉颇与赵括的军事对决
表示论:现代数学的核心与桥梁
巴黎奥运会前夕 埃菲尔铁塔票价将上涨20%
健康生活:跆拳道培养意志力与自律性格!
油茶树繁殖技术哪家强?一文读懂三种主流繁殖方法
欧罗巴焦点战:阿贾克斯大战拉齐奥
黄磊"神厨"人设崩塌:从"料理大师"到"样样松"
纪念丨1990年,琼瑶的电视剧时代开始了
秋游北京正当时:故宫金黄、香山火红、颐和园碧绿
新型高分辨率DAC融合多项创新,为数字化转型注入新动力
《学龄前儿童膳食指南》教你科学喂养
吉林省养老金调整最新消息:2024年或延续3.8%涨幅
伤残鉴定标准大不同:一个案例揭示关键差异
嵌甲防治必读:从日常护理到专业治疗方案
沪深300指数五大解析:市场风向标的投资价值与机遇
<我的世界>15周年:跨平台1.5亿月活,持续创新引领游戏界
五步轻松去除衣物油渍,从预处理到清洗全攻略
从平台游戏到文化符号:马里奥系列40年发展回顾
游戏行业50年:移动平台崛起,掌机时代终结
炖牛腩时,只需3个小窍门,牛肉软烂易嚼,小孩老人吃都特方便
警惕!肝囊肿快速增大可能是囊腺瘤,这些预防措施要记牢
大连老虎滩极地馆游玩攻略:与极地动物亲密接触的奇妙之旅
打造个性化穿搭:从基础选择到配饰搭配的实用指南
浏览器卡顿?教你几招秒变流畅
从3年到7年:中国乒坛五位大满贯得主的夺冠之路
炸药库管理制度:确保C-4炸药安全的关键
调车5万钩零差错,佟德鑫摘得“国家能源杯”桂冠
缺木的男孩名字 五行缺木男孩宜用字
养护知识 | 足球场天然草主要选种的是什么品种?有什么讲究呢?
热继电器整定电流,电机保护神器