2017-02-08 143 views
0

我需要两个输入文件的绘图图形,其中始终为x轴时间(00:00-23:59),并且每分钟一次显示数据。在一个文件是完整的完整范围(时间00:00 - 23:59),在第二个总是不同的范围(比如说01:45 - 2:45) - 这是可变的(我正在使用gnuplot作为监测)。如何加入这两个文件只绘制通用部分?Gnuplot - 如何仅使用公用数据加入两个文件

谢谢

Standa

+0

欢迎堆栈溢出!你可以先参加[游览]并学习[问]一个很好的问题,然后创建一个[mcve]。这使我们更容易帮助你。 – Katie

回答

0

我知道你有一个包含从00:00到23:59的数据文件a.dat,像这样:

# 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 

这是输出与我的测试数据: plot two files with xrange of the smaller one

相关问题