分类散点图 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')
相关推荐
码农三叔3 天前
(3-2-01)视觉感知:目标检测与分类
人工智能·目标检测·分类·机器人·人机交互·人形机器人
DeepModel3 天前
【分类算法】ID3算法超详细讲解
分类·分类算法
向哆哆3 天前
粉尘环境分类检测千张图数据集(适用YOLO系列)(已标注+划分/可直接训练)
yolo·分类·数据挖掘
ppppppatrick5 天前
【深度学习基础篇04】从回归到分类:图像分类与卷积神经网络入门
人工智能·深度学习·分类
啊阿狸不会拉杆5 天前
《计算机视觉:模型、学习和推理》第 9 章-分类模型
人工智能·python·学习·算法·机器学习·计算机视觉·分类
小雨中_6 天前
2.1 PaLM 及其变体(PaLM / PaLM 2)
人工智能·深度学习·机器学习·分类·数据挖掘·palm
追风少年ii6 天前
第12篇HD文章--射血分数保留的心力衰竭患者左心室心肌免疫细胞丰度正常
python·分类·数据分析·空间·单细胞
石去皿7 天前
文本分类常见面试篇:从 fastText 到 TextCNN 的核心考点全解析
面试·分类·数据挖掘
追风少年ii7 天前
内容复习--邻域分子聚类与邻域细胞聚类的生物学意义及异同
分类·数据挖掘·空间·单细胞·cn