gnuplot 中的箱线图。如何在一个箱线图中绘制不同的组?
Boxplot in gnuplot. How to plot different groups in one boxplot?
我有一个包含 10 列数据的文件 (download data),不同列的样本之间存在差异。测量是在同一时间完成的,但频率不同,我有不匹配的情况。我试图用 using
语句 using x:data:width:level
的第四个字段将它们绘制成不同的组,我使用了以下代码:
set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7
set style data boxplot
set title 'all_templates' font 'Arial,14';
set xtics ('1' 1, '2' 2, '3' 3, '4' 4, '5' 5, '6' 6, '7' 7, '8' 8, '9' 9, '10' 10) scale 0,0
plot for [i=1:10] 'all_template.dat' using (i):i:(1):10 notitle`
但是这个图看起来很奇怪,例如第 9 列的中位数在 300 毫秒左右,但是在图中,代表第 9 列的方框不超过 200。箱线图似乎一直在考虑垃圾箱,尽管我指定有 10 个不同的组。任何帮助将不胜感激!
您的数据文件中的列长度不同,并且您使用制表符作为列分隔符。 Gnuplot 默认使用任何白色 space 作为列分隔符并将连续的白色 space 合并为一个。因此,两个或三个选项卡被视为单个列分隔符,这会弄乱您的列。使用
set datafile separator '\t'
将所有值保存在正确的列中。
set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7
set style data boxplot
set boxwidth 0.7 absolute
set title 'all_templates' font 'Arial,14'
set xtics 1,1,10 scale 0
set datafile separator '\t'
plot for [i=1:10] 'all_template.dat' using (i):i notitle
我有一个包含 10 列数据的文件 (download data),不同列的样本之间存在差异。测量是在同一时间完成的,但频率不同,我有不匹配的情况。我试图用 using
语句 using x:data:width:level
的第四个字段将它们绘制成不同的组,我使用了以下代码:
set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7
set style data boxplot
set title 'all_templates' font 'Arial,14';
set xtics ('1' 1, '2' 2, '3' 3, '4' 4, '5' 5, '6' 6, '7' 7, '8' 8, '9' 9, '10' 10) scale 0,0
plot for [i=1:10] 'all_template.dat' using (i):i:(1):10 notitle`
但是这个图看起来很奇怪,例如第 9 列的中位数在 300 毫秒左右,但是在图中,代表第 9 列的方框不超过 200。箱线图似乎一直在考虑垃圾箱,尽管我指定有 10 个不同的组。任何帮助将不胜感激!
您的数据文件中的列长度不同,并且您使用制表符作为列分隔符。 Gnuplot 默认使用任何白色 space 作为列分隔符并将连续的白色 space 合并为一个。因此,两个或三个选项卡被视为单个列分隔符,这会弄乱您的列。使用
set datafile separator '\t'
将所有值保存在正确的列中。
set style fill solid 0.25 border -1
set style boxplot outliers pointtype 7
set style data boxplot
set boxwidth 0.7 absolute
set title 'all_templates' font 'Arial,14'
set xtics 1,1,10 scale 0
set datafile separator '\t'
plot for [i=1:10] 'all_template.dat' using (i):i notitle