我有一组大量的数据点。我尝试用箱线图绘制它们,但其中一些异常值具有相同的值,并在一条线上表示。我找到了一个链接How to set the horizontal distance between outliers in gnuplot boxplot,但并没有太大帮助,因为显然不可能实现。
这段代码已经存在,如何最好地实现它?
是否有可能将异常值分组,仅打印一个点,然后在其旁边打印一个数字括号以指示有多少个点?我认为这将使图表更易读。
作为参考,对于一个x值,我有三个箱线图,在一个图中重复六次。我正在使用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
这段代码已经存在,如何最好地实现它?
cairolatex
终端时。你必须在实际绘图之前直接设置cairolatex
终端和输出文件,对于pdfcairo
则无所谓。不知道为什么会发生这种情况。 - Christoph