Gnuplot图形线重叠并可以';看不见

Gnuplot图形线重叠并可以';看不见,gnuplot,Gnuplot,这是我要打印的3个文件的数据: 文件1 文件2 文件3 以下是我用来绘制图表的命令: 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:1

这是我要打印的3个文件的数据:

文件1

文件2

文件3

以下是我用来绘制图表的命令:

 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
这是生成的图形:


如您所见,文件1中的点的范围为01:12:06到01:14:07,但图表并未显示文件1中的所有点。file3也是如此。要么打印线重叠,要么gnuplot丢弃所有这些数据。我想看到3行的3个文件

如前所述,第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

考虑到gnuplot用第三行覆盖第1行,我看到了不同的可能性(或可能性的组合)

  • 指定不同的线宽(从大到小),或
  • 为线条指定不同的颜色(从浅到深),或
  • 为标记指定不同的大小(在本例中,我建议使用圆形标记),或
  • 为行添加一个不同的小移位
  • 我有点不喜欢第四点,因为它违背了数据的可靠性,但我们是不道德的人,不是吗

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

    编辑
    我现在意识到,第2点并不代表我们问题的独立解决方案,但在与线条或标记宽度配合使用时效果良好。

    在我的例子中,我首先绘制了重叠最大的数据集。然后我用下一个最大重叠的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命令:

    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" 
    

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

    您是否尝试过以不同的顺序打印它们?尝试
    使用1:2标题“connection-1”lw 6打印“file1”,使用1:2标题“connection-2”打印“file2”,使用1:2标题“connection-3”打印“file3”
    NB我在可能透支的线条上添加了一个大的线条宽度规格。@GBOFI添加大线条表明绘图确实存在,但相互重叠和隐藏。有没有一种方法可以像Excel那样堆叠这些行?你说“像Excel那样堆叠行”是什么意思?@user1071840如果你只想单独查看它们,你可以使用
    multiplot
    :例如
    设置multiplot布局3,1
    ,然后使用三个单独的
    plot
    plot“file1”,使用1:2标题“连接-1”;使用1:2标题“连接-2”绘制“文件2”;使用1:2标题“连接-3”绘制“文件3”
    plot "file1" using 1:($2+10) with linespoints pointtype 4   # shift all y-values by 10
    
    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"