如何绘制带有不同文件的2个箱线图? Gnuplot

时间:2019-12-20 22:51:34

标签: gnuplot boxplot

因此,我试图用不同的文件绘制两个不同的箱形图,这是我的代码:

set boxwidth 0.5
set style fill solid 0.5
set xlabel ""
set ylabel "Boxplot Value"
set grid layerdefault
set xtics ("Data A" 1, "Data B" 2)
set xtics rotate by -50
plot "out4.txt" using (1):1 notitle with boxplot, "out20.txt" using (1):2 notitle with boxplot

出现此错误:“ boxplot.gnu”,第8行:警告:正在跳过没有有效点的数据文件

我的数据是这样排列的:

  

2

     

3

     

4

     

5

     

6

     

7

     

6

     

23

     

423

     

42

     

342

     

34

     

234

只有一列,两个文件中的数据相同。

1 个答案:

答案 0 :(得分:0)

如果文件"out20.txt"也仅包含一列,那么如果您写"out20.txt" using (1):2,gnuplot应该如何绘制?没有第二列要绘制。这就是gnuplot告诉您的“跳过没有有效点的数据文件”。

如果"out4.txt"对应于Data A处的x=1,并且"out20.txt"对应于Data B处的x=2,则应显示将第8行更改为以下内容您的图表:

plot "out4.txt" using (1):1 notitle with boxplot, "out20.txt" using (2):1 notitle with boxplot