分类散点图 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')
相关推荐
计算机软件程序设计8 小时前
深度学习在图像识别中的应用-以花卉分类系统为例
人工智能·深度学习·分类
亲持红叶13 小时前
sklearn中的决策树-分类树:重要参数
决策树·分类·sklearn
lcw_lance14 小时前
人工智能(AI)的不同维度分类
人工智能·分类·数据挖掘
huaqianzkh17 小时前
理解构件的3种分类方法
人工智能·分类·数据挖掘
ww180002 天前
多目标粒子群优化算法-MOPSO-(机器人路径规划/多目标信号处理(图像/音频))
人工智能·算法·分类·信号处理
xiao5kou4chang6kai42 天前
基于python深度学习遥感影像地物分类与目标识别、分割实践技术应用
python·深度学习·分类
zhengyawen6662 天前
深度学习之图像分类(一)
人工智能·深度学习·分类
无极工作室(网络安全)2 天前
机器学习小项目之鸢尾花分类
人工智能·机器学习·分类
程序员JerrySUN3 天前
树莓派 4B:AI 物联网完整部署方案
linux·人工智能·嵌入式硬件·物联网·分类·数据挖掘
de之梦-御风3 天前
【OpenCV】OpenCV 中各模块及其算子的详细分类
人工智能·opencv·分类