分类散点图 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')
相关推荐
xy_optics5 小时前
用matlab搭建一个简单的图像分类网络
网络·matlab·分类
jerry6096 小时前
多分类交叉熵
机器学习·数学建模·分类
大多_C13 小时前
量化方法分类
人工智能·分类·数据挖掘
怀逸%21 小时前
二十种中药果实识别分类系统,Python/resnet18/pytorch
pytorch·python·分类
Elastic 中国社区官方博客2 天前
Elasticsearch:使用机器学习生成筛选器和分类标签
大数据·人工智能·elasticsearch·机器学习·搜索引擎·ai·分类
MPCTHU3 天前
预测分析(三):基于机器学习的分类预测
人工智能·机器学习·分类
荷包蛋蛋怪3 天前
【北京化工大学】 神经网络与深度学习 实验6 MATAR图像分类
人工智能·深度学习·神经网络·opencv·机器学习·计算机视觉·分类
西柚小萌新4 天前
【深度学习:进阶篇】--2.1.多分类与TensorFlow
分类·数据挖掘·tensorflow
简简单单做算法4 天前
基于mediapipe深度学习和限定半径最近邻分类树算法的人体摔倒检测系统python源码
人工智能·python·深度学习·算法·分类·mediapipe·限定半径最近邻分类树
IT从业者张某某5 天前
机器学习-04-分类算法-03KNN算法案例
算法·机器学习·分类