2017-02-08 119 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

相關問題