分类散点图 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')
相关推荐
机器学习之心1 天前
分类预测 | Matlab实现ABC-Transformer人工蜂群算法优化编码器多特征分类预测/故障诊断Matlab实现
算法·matlab·分类
yzx9910132 天前
使用SVM进行图像分类
机器学习·支持向量机·分类
終不似少年遊*2 天前
MindSpore框架学习项目-ResNet药物分类-数据增强
人工智能·深度学习·分类·数据挖掘·华为云·resnet·modelart
蜡笔小新..3 天前
从零开始:用PyTorch构建CIFAR-10图像分类模型达到接近1的准确率
人工智能·pytorch·机器学习·分类·cifar-10
Tech Synapse3 天前
联邦学习图像分类实战:基于FATE与PyTorch的隐私保护机器学习系统构建指南
pytorch·机器学习·分类
漠缠3 天前
手机相册的 “智能分类” 功能
智能手机·分类·数据挖掘
zeroporn3 天前
在Mac M1/M2上使用Hugging Face Transformers进行中文文本分类(完整指南)
macos·分类·数据挖掘·nlp·transformer·预训练模型·文本分类
BioRunYiXue4 天前
一文了解氨基酸的分类、代谢和应用
人工智能·深度学习·算法·机器学习·分类·数据挖掘·代谢组学
白杆杆红伞伞4 天前
02_线性模型(回归分类模型)
分类·数据挖掘·回归
yzx9910135 天前
支持向量机与逻辑回归的区别及 SVM 在图像分类中的应用
支持向量机·分类·逻辑回归