分类散点图 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')
相关推荐
max5006002 小时前
基于Meta Llama的二语习得学习者行为预测计算模型
人工智能·算法·机器学习·分类·数据挖掘·llama
周杰伦_Jay7 小时前
【图文详解】强化学习核心框架、数学基础、分类、应用场景
人工智能·科技·算法·机器学习·计算机视觉·分类·数据挖掘
Wah-Aug12 小时前
深度学习视角下的图像分类
人工智能·深度学习·分类
神仙别闹2 天前
基于 Python Keras 实现 猫狗图像的精准分类
python·分类·keras
拉拉拉拉拉拉拉马2 天前
DINOv3详解+实际下游任务模型使用细节(分割,深度,分类)+ Lora使用+DINOv1至v3区别变换分析(可辅助组会)
人工智能·分类·数据挖掘
悟乙己2 天前
机器学习常见的分类与回归模型目标变量系统性设计与实践(一)
机器学习·分类·回归
jie*2 天前
小杰机器学习(seven)——贝叶斯分类
人工智能·python·深度学习·神经网络·机器学习·分类·scikit-learn
盼小辉丶2 天前
Transformer实战(19)——微调Transformer语言模型进行词元分类
深度学习·语言模型·分类·transformer
HenrySmale11 天前
05 回归问题和分类问题
分类·数据挖掘·回归
✎﹏赤子·墨筱晗♪11 天前
深入浅出LVS负载均衡群集:原理、分类与NAT模式实战部署
分类·负载均衡·lvs