分类散点图 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')
相关推荐
song5014 小时前
React Native for OpenHarmony 实战:三方库 react-native-ratings 的鸿蒙化适配指南
javascript·react native·react.js·分类·harmonyos
呆萌很5 小时前
长尾分类(Long-tailed Classification)方法汇总
人工智能·分类
OCR_133716212752 天前
智能交通底层逻辑:国内车牌分类规范与AI识别适配技术解析
大数据·人工智能·分类
FPGA信号处理2 天前
【模式识别】第三节课:分类误差的来源与线性分类器
人工智能·分类·数据挖掘
Dfreedom.3 天前
分类算法的统一视角:从方差最大化到概率建模再到损失函数
算法·支持向量机·分类
一木 之林5 天前
提示词工程学习总结:用 Few-shot 把大模型调教成金融文本分类、抽取与匹配的自动化流水线
人工智能·学习·计算机视觉·金融·分类
howdoyoudo2026066 天前
当新案例冲击旧框架:分类系统的宿命与修正路径
大数据·网络·数据库·人工智能·安全·ai·分类
山顶夕景8 天前
【Jev】Jev模型和Laya架构
分类·大模型·dev
程序猿阿森8 天前
FastText 全面解析:从文本张量表示到文本分类实战
人工智能·分类·数据挖掘
天一生水water10 天前
时间序列非平衡样本分类研究综述:发展脉络、核心方法与前沿方向
人工智能·分类·数据挖掘