分类散点图 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')
相关推荐
楚韵天工12 小时前
基于多分类的工业异常声检测及应用
人工智能·深度学习·神经网络·目标检测·机器学习·分类·数据挖掘
OpenC++14 小时前
【机器学习】核心分类及详细介绍
人工智能·机器学习·分类
Blossom.1181 天前
把大模型当“温度计”——基于 LLM 的分布式系统异常根因定位实战
人工智能·python·深度学习·机器学习·自然语言处理·分类·bert
RIKI_11 天前
【浅学】tflite-micro + ESP32S3 + VScode + ESP-IDF 基于例程快速实现自己的图像分类模型训练部署全流程
单片机·分类
云空1 天前
《基于Pytorch实现的声音分类 :网页解读》
人工智能·pytorch·分类
Debroon2 天前
CV 医学影像分类、分割、目标检测,之【血细胞分类】项目拆解
目标检测·分类·数据挖掘
Debroon2 天前
CV 医学影像分类、分割、目标检测,之【肝脏分割】项目拆解
目标检测·分类·数据挖掘
Debroon2 天前
CV 医学影像分类、分割、目标检测,之【腹腔多器官语义分割】项目拆解
目标检测·分类·数据挖掘
拉一次撑死狗2 天前
机器学习实战·第三章 分类(2)
人工智能·机器学习·分类
weixin_456904273 天前
基于Tensorflow2.15的图像分类系统
人工智能·分类·tensorflow