带有最小值、最大值、平均值和标准偏差的箱线图 [英] Box plot with min, max, average and standard deviation

查看:132
本文介绍了带有最小值、最大值、平均值和标准偏差的箱线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个包含某些运行结果的箱线图 - 对于这些运行中的每一个,我都有最小输出、最大输出、平均输出和标准偏差.这意味着我将需要16个带有标签的箱线图.

I need to create a box plot with results for some runs - for each of these runs I have the minimum output, maximum output, average output and standard deviation. This means that I will need 16 boxplots with labels.

The examples I ran into so far plot a numerical distribution, but in my case, this is not feasible.

Is there any way to do this in Python (Matplotlib) / R?

解决方案

The answer given by @Roland above is important: a box plot shows fundamentally different quantities, and if you make a similar plot using the quantities you have, it might confuse users. I might represent this information using stacked errorbar plots. For example:

import matplotlib.pyplot as plt
import numpy as np

# construct some data like what you have:
x = np.random.randn(100, 8)
mins = x.min(0)
maxes = x.max(0)
means = x.mean(0)
std = x.std(0)

# create stacked errorbars:
plt.errorbar(np.arange(8), means, std, fmt='ok', lw=3)
plt.errorbar(np.arange(8), means, [means - mins, maxes - means],
             fmt='.k', ecolor='gray', lw=1)
plt.xlim(-1, 8)

这篇关于带有最小值、最大值、平均值和标准偏差的箱线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆