箱ひげ図 (boxplot, box-and-whisker plot)

概要

\(\{(\text{label}_i, z_i)\}_i\) ( \(z_i \in \mathbb R\) ) というデータ列から, 次の図のような箱ひげ図を作成する.

with boxplot によって直接サポートされている.

References

Data Format

一列目にデータのラベル (またはカテゴリ) を文字列で与える. これに関してソートする必要はない. 二列目にデータの実数値を与える.

Label_1 z1
Label_2 z2
:
Label_n zn

with boxplot

plot .. using <x>:<z>{:<box_width>{:<label>}} with boxplot
params default value explanation
x -- (double)x データ (箱ひげ) を置く x 座標
z -- (double)z データ (実数値)
box_width -- (double) 箱の横幅サイズ
label -- (string) データのラベル. これを与えるとき x は無視される

ラベルを与える時 x は無視されるが何か与える必要があるので, 仮にゼロを与えておく.

先述のデータに合わせると次のようにすればよい.

using (0):2:(1):1 with boxplot

Examples

set grid
unset key
plot '< ruby -e "srand; puts (0..2).flat_map {|i| 100.times.map { \"Label#{i} #{Math.sqrt(-2*Math.log(rand))*Math.cos(2*Math::PI*rand) + i}\" } }"' using (0):2:(0):1 with boxplot
Gnuplot Produced by GNUPLOT 6.0 patchlevel 0 -3 -2 -1 0 1 2 3 4 5 Label0 Label1 Label2 '< ruby -e "srand; puts (0..2).flat_map {|i| 100.times.map { \"Label#{i} #{Math.sqrt(-2*Math.log(rand))*Math.cos(2*Math::PI*rand) + i}\" } }"' using (0):2:(0):1