分类散点图 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 小时前
X、Y电容的分类与选择
人工智能·分类·数据挖掘·追梦人电力电子
叫我:松哥5 小时前
基于深度卷积神经网络的水果图片分类算法设计与实现,有ResNet50的迁移学习模型,准确率达95%
人工智能·python·神经网络·机器学习·分类·cnn·迁移学习
ZHW_AI课题组8 小时前
基于KNN的帕尔默企鹅种类预测分类
人工智能·机器学习·分类·数据挖掘
2401_885665199 小时前
从零搭建卷积神经网络:基于PyTorch实现MNIST手写数字分类
pytorch·python·神经网络·算法·机器学习·分类·cnn
疯狂打码的少年10 小时前
【程序语言与编译】文法的分类(0-3型,乔姆斯基体系)
人工智能·笔记·分类·数据挖掘
Promise微笑10 小时前
气体露点仪测量技术:露点仪原理、分类、选型与应用前沿
人工智能·分类·数据挖掘
金斗潼关11 小时前
PyTorch+CNN实现衣物分类
pytorch·分类·cnn
KKKlucifer1 天前
数据分类分级排名解析:三大核心能力决定选型方向
大数据·数据库·分类
FrameNotWork1 天前
HarmonyOS6.1 图像分类应用完整实战:从模型到界面
人工智能·分类·数据挖掘·harmonyos
@insist1231 天前
系统架构设计师-操作系统核心原理与分类体系
分类·数据挖掘·系统架构·软考·系统架构设计师·软件水平考试