Gnuplot图线重叠,无法看到

时间:2014-11-29 11:18:06

标签: gnuplot

这是我要绘制的3个文件的数据:

文件1

 01:12:06 90000
 01:12:07 30000
 01:12:17 30000
 01:12:27 30000
 01:12:37 30000
 01:12:47 30000
 01:12:57 30000
 01:13:07 30000
 01:13:17 30000
 01:13:27 30000
 01:13:37 30000
 01:13:47 90000
 01:13:57 30000
 01:14:07 30000

file2的

 01:12:02 90000
 01:12:07 30000
 01:12:17 30000
 ...
 01:18:47 90000
 01:18:57 90000

file3的

 01:12:04 90000
 01:12:07 30000
 01:12:17 30000
 ...
 01:15:37 45000
 01:15:47 45000

这些是我用来绘制图形的命令:

 gnuplot> set xdata time; set timefmt '%H:%M:%S';
 gnuplot> set format x "%H:%M:%S" 
 gnuplot> set xlabel "time"; 
          set ylabel "Data rates"; 
          set grid;
          set xrange ["01:12:04" : "01:18:57"];
          set yrange ["0" : "100000"];
          set style data linespoints; 
          plot "file1" using 1:2 title "connection-1", "file2" using 1:2 title "connection-2", "file3" using 1:2 title "connection-3

这是生成的图表: enter image description here

正如您所看到的,file1的分数范围为01:12:06到01:14:07,但图表并未显示file1中的所有分数。对于file3也是如此。绘图线重叠或gnu​​plot丢弃所有这些数据。我想看到3个文件的3行。

3 个答案:

答案 0 :(得分:1)

鉴于gnuplot用第三行覆盖第一行,我看到了不同的可能性(或可能性的组合)

  1. 指定不同的线宽(更大到更薄)或
  2. 为您的线条指定不同的颜色(更亮到更暗),或
  3. 为标记指定不同的大小(在这种情况下,我建议使用圆圈标记)或
  4. 为线条添加不同的小班次。
  5. 我不喜欢,只是一点点,因为它反对数据的神圣性,但我们是不道德的人,不是吗?

    我保证,当我了解Excel使用的解决方案时,我会尝试更新我的答案。

    修改

    第2点,我现在意识到,它并不能代表我们问题的独立解决方案,但在线条或标记宽度的ccoperation中应用效果很好。

答案 1 :(得分:0)

如上所述,行号为点。 3由' +'组成。和一个' x' ,所以他们隐藏了1号线(' +')和2号线(' x')

您可以选择其他点标记。使用命令test获取可用样式的概述。

例如,

plot ... pointtype 4,\
     ... pointtype 6,\
     ... pointtype 8

第一个使用正方形,第二个圆圈和第三个三角形。

根据评论:不可能人为地改变线条。但您可以为值添加常量:

plot "file1" using 1:($2+10) with linespoints pointtype 4   # shift all y-values by 10

答案 2 :(得分:0)

就我而言,我首先绘制了重叠程度最大的数据集。然后我绘制了具有下一个最大重叠e.t.c的数据集。这样,重叠较少的线被绘制在具有更大重叠(更长线)的线上方。 特别是这是我的文件:

1, 0.50000000023514612479
2, 0.50000000002351452366

1, 0.50000000023514612479
2, 0.50000000002351452366
3, 0.50000000000235200748

1, 0.50000000023514612479
2, 0.50000000002351452366
3, 0.50000000000235200748
4, 0.50000000000023503421

1, 0.50000000023514612479
2, 0.50000000002351452366
3, 0.50000000000235200748
4, 0.50000000000023503421
5, 0.50000000000001576517

1, 0.50000000023514612479
2, 0.50000000002351452366
3, 0.50000000000235200748
4, 0.50000000000023503421
5, 0.50000000000001576517
6, 0.50000000000000022204

情节命令:

plot "file.txt" index 4 with linespoints title "alpha:1e-05" , \
     "file.txt" index 3 with linespoints title "alpha:1e-04",\
     "file.txt" index 2 with linespoints title "alpha:1e-03",\
     "file.txt" index 1 with linespoints title "alpha:1e-02",\
     "file.txt" index 0 with linespoints title "alpha:1e-01" 

然后,您可以使用不同的线宽来区分线条。