分类散点图 stripplot() 加辅助线axhline() 多图合一

分类散点图 stripplot 加辅助线axhline 多图合一

画图没有什么可说的,直接上图

效果图

代码

python 复制代码
# 绘制图, 查看是否数值在阈值上
plt.figure(figsize=(30, 18))
n = 0
for header, value_list in info_dict.items():
    ref_value_list = ref_info_dict[header]
    threshold = 1000
    if header == 'uniformity':
        threshold = 0.9
    elif header in ('median_depth', 'average_depth'):
        threshold = 900
    elif header in ('dedup_median_depth', 'dedup_average_depth'):
        threshold = 200
    print(threshold)
    n += 1
    plt.subplot(3, 3, n)
    # 将数据合并为数据框
    df = pd.DataFrame({'Group': ['test']*len(value_list) + ['ref']*len(ref_value_list),
                   'Value': value_list + ref_value_list})
    # 添加每个值的 stripplot, palette 指定调色板颜色
    sns.stripplot(x='Group', y='Value', data=df, dodge=True, alpha=0.5, jitter=True, palette=['blue', 'green'])
    plt.axhline(y=threshold, color='red', linestyle='--', label='threshold Line')
    # 添加直线上的数值标签
    plt.text(0, threshold, threshold, color='red', fontsize=20)
    plt.title(header)
# 添加大图标题
plt.suptitle('大图标题', fontsize=30)
# 显示图例
plt.legend()
# 调整子图之间的间距
plt.tight_layout()
# 显示图形
plt.show()
plt.savefig('tmp.jpg')
相关推荐
酷酷的崽79820 小时前
CANN 开源生态实战:端到端构建高效文本分类服务
分类·数据挖掘·开源
是小蟹呀^1 天前
从稀疏到自适应:人脸识别中稀疏表示的核心演进
人工智能·分类
AAD555888992 天前
YOLO11-EfficientRepBiPAN载重汽车轮胎热成像检测与分类_3
人工智能·分类·数据挖掘
小徐xxx2 天前
Softmax回归(分类问题)学习记录
深度学习·分类·回归·softmax·学习记录
AAD555888992 天前
YOLOv8-MAN-Faster电容器缺陷检测:七类组件识别与分类系统
yolo·分类·数据挖掘
JicasdC123asd2 天前
【工业检测】基于YOLO13-C3k2-EIEM的铸造缺陷检测与分类系统_1
人工智能·算法·分类
子夜江寒2 天前
基于 LSTM 的中文情感分类项目解析
人工智能·分类·lstm
是小蟹呀^2 天前
Focal Loss:解决长尾图像分类中“多数类太强势”的损失函数
人工智能·机器学习·分类
2501_941329722 天前
基于Centernet的甜菜幼苗生长状态识别与分类系统
人工智能·分类·数据挖掘
Daydream.V2 天前
决策树三中分类标准
算法·决策树·分类