分类散点图 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')
相关推荐
听风吹等浪起7 小时前
第26章:ViT+InceptionDW+FocalLoss改进|CT骨折影像二分类完整Pytorch实现(含PyQt5推理GUI)
pytorch·qt·分类
雨晨源码(同名B站)21 小时前
深度学习毕业设计选题推荐:基于卷积神经网络的无人机影像建筑裂缝裂纹检测分类与分割系统(LeNet-5 二分类模型、GCN-Res50分割模型)
深度学习·信息可视化·分类·cnn·毕业设计·无人机·课程设计
JAVA_AI人工智能项目实战1 天前
轻量级模型训练_RNN文本分类流水线实验代码
人工智能·rnn·分类
吴名氏.2 天前
Java转AI Agent教程(第二周)超时重试与错误分类
java·人工智能·python·分类·ai agent
听风吹等浪起2 天前
第27章:EfficientNet全家桶|钢材表面6类缺陷分类完整Pytorch实现
pytorch·分类·数据挖掘
kaixin_啊啊4 天前
【零基础学AI】第 19 章——用分类模型识别类别
人工智能·分类·数据挖掘
a puppy slide 葱5 天前
arXiv _ 2025 _ Gaussian Masked Autoencoders
论文阅读·人工智能·python·分类
Interview Aid1126 天前
McKinsey OA 真题解析:数组优化与机器学习分类
人工智能·机器学习·分类
听风吹等浪起6 天前
第25章:基于ConvNeXt实现肺部CT肺癌四分类:数据集、训练调优、网络结构与Streamlit网页部署
人工智能·分类·数据挖掘
IT研究室7 天前
最新计算机毕业设计选题推荐-基于深度学习的塑料类型图像分类研究-运行部署-文档指导-深度学习-YOLO
深度学习·分类·课程设计