Linux Gnuplot-如何仅使用公共数据连接两个文件

Linux Gnuplot-如何仅使用公共数据连接两个文件,linux,graph,gnuplot,monitoring,Linux,Graph,Gnuplot,Monitoring,我需要从两个输入文件中绘制图形,其中始终是x轴时间(00:00-23:59),数据逐分钟显示。在一个文件中是完整的全范围(时间在00:00-23:59之间),在第二个文件中总是不同的范围(比如01:45-2:45),这是可变的(我使用gnuplot作为监视)。如何连接这两个文件以仅打印公共部分 多谢各位 Standa据我所知,您有一个文件a.dat,其中包含从00:00到23:59的数据,如下所示: # a.dat ... 01:01 1 01:02 2 01:03 3 01:04 4

我需要从两个输入文件中绘制图形,其中始终是x轴时间(00:00-23:59),数据逐分钟显示。在一个文件中是完整的全范围(时间在00:00-23:59之间),在第二个文件中总是不同的范围(比如01:45-2:45),这是可变的(我使用gnuplot作为监视)。如何连接这两个文件以仅打印公共部分

多谢各位


Standa

据我所知,您有一个文件a.dat,其中包含从00:00到23:59的数据,如下所示:

# a.dat
...
01:01  1
01:02  2
01:03  3
01:04  4
01:05  5
01:06  6
01:07  7
01:08  8
...
以及包含可变时间范围数据的文件b.dat,如下所示:

# b.dat
01:04 4.2
01:05 5.2
01:06 6.2
您可以使用类似以下脚本的内容,使用第二个文件的时间范围打印这两个文件:

# Prepare for plotting time data
set timefmt "%H:%M"
set xdata time
set format x "%H:%M"

# The 'stats' command does not work for time data. So we make a 
# 'dummy' plot of the smaller file, b.dat. This will store the 
# xrange in the variables GPVAL_DATA_X_MIN/MAX.
plot "b.dat" using 1:2

# Prepare the real plot.
set terminal pngcairo
set output "data.png"

# Explicitly set xrange of file b.dat
set xrange [GPVAL_DATA_X_MIN:GPVAL_DATA_X_MAX]

# The actual plot:
plot "a.dat" using 1:2  w lp ls 6, "b.dat" using 1:2  w p ls 7 
这是我的测试数据的输出:

欢迎使用堆栈溢出!你可以选择第一个,学习一个好的问题,然后创造一个新的答案。这使我们更容易帮助你。