我有一大组数据点。我尝试用boxplot来绘制它们,但某些异常值是完全相同的值,并且它们在一行旁边表示。我发现How to set the horizontal distance between outliers in gnuplot boxplot,但它并没有太多帮助,因为它显然是不可能的。如何在gnuplot中对boxplot异常值进行组合
是否可以将异常值组合在一起,打印一个点,然后在旁边的括号内打印一个数字以指示有多少个点?我认为这会使图形更具可读性。
有关信息,我有一个x值的三个boxlot和一个图中的六个时间。我正在使用gnuplot 5,并且已经使用了分号,这不会再减少距离。 我希望你能帮助!
编辑:
set terminal pdf
set output 'dat.pdf'
file0 = 'dat1.dat'
file1 = 'dat2.dat'
file2 = 'dat3.dat'
set pointsize 0.2
set notitle
set xlabel 'X'
set ylabel 'Y'
header = system('head -1 '.file0);
N = words(header)
set xtics ('' 1)
set for [i=1:N] xtics add (word(header, i) i)
set style data boxplot
plot file0 using (1-0.25):1:(0.2) with boxplot lw 2 lc rgb '#8B0000' fs pattern 16 title 'A'
plot file1 using (1):1:(0.2) with boxplot lw 2 lc rgb '#00008B' fs pattern 4 title 'B'
plot file2 using (1+0.25):1:(0.2) with boxplot lw 2 lc rgb '#006400' fs pattern 5 title 'C'
for [i=2:N] plot file0 using (i-0.25):i:(0.2) with boxplot lw 2 lc rgb '#8B0000' fs pattern 16 notitle
for [i=2:N] plot file1 using (i):i:(0.2) with boxplot lw 2 lc rgb '#00008B' fs pattern 4 notitle
for [i=2:N] plot file2 using (i+0.25):i:(0.2) with boxplot lw 2 lc rgb '#006400' fs pattern 5 notitle
这有什么代码已经到位,以实现它的最佳方式?
谢谢!这个解决方案非常好。唯一的问题是,它打印出每一点,即使那些原本没有点的地方,如果你用boxplot打印它。你还可以看看我的原始文章中的编辑?我发布了我现在使用的东西,而且我不得不说我显然不适应Gnuplot。 ;)是否也可以改变点的大小和数字的大小? PS:它需要在第二个代码片段中是upper_limit和lower_limit。 ;) – Patrick 2015-04-01 10:09:41
当绘制标签时,你必须检查计数的数量是否> 0,我编辑了答案。你可以像往常一样改变分数。 'ps 2',你也可以使用'font'选项来绘制'标签',比如'plot ... with labels font',12''。 – Christoph 2015-04-01 11:06:38
出于测试目的,我使用了pdf终端,但我想在最后使用它与cairolatex。我意识到,cairolatex的点和标签根本不打印。你知道一个方法来绕过它吗? – Patrick 2015-04-01 13:40:35