Gnuplot 中丢失的数据点

Lost Data Point in Gnuplot

我有一个简单的时间序列:

2015-05-03 07:00,58
2015-05-03 08:00,61
2015-05-03 09:00,65
2015-05-03 10:00,69
2015-05-03 11:00,72
2015-05-03 12:00,74
2015-05-03 13:00,76
2015-05-03 14:00,78
2015-05-03 15:00,78
2015-05-03 16:00,78
2015-05-03 17:00,77
2015-05-03 18:00,76
2015-05-03 19:00,73
2015-05-03 20:00,70
2015-05-03 21:00,67
2015-05-03 22:00,66
2015-05-03 23:00,64
2015-05-04 00:00,63
2015-05-04 01:00,62
2015-05-04 02:00,62
2015-05-04 03:00,61
2015-05-04 04:00,61
2015-05-04 05:00,60
2015-05-04 06:00,60

使用:

reset

set terminal pngcairo enhanced background "#000000" font "Arial,10" size 600,200 truecolor
dataFileForecast = "/Users/.../Dropbox/Public/hourlyForecast.csv"
set datafile separator ','
stats dataFileForecast using 2 nooutput

freezeWarning = 32
Yhigh = (STATS_mean * 1.5)
Ylow = (STATS_mean - (STATS_mean * 0.5))

set timefmt "%Y-%m-%d %H:%M"
set output "/Users/.../Dropbox/Public/hourlyForecast.png"

set tics tc rgb "#666666"
set border lt rgb "#666666"
set boxwidth 0.25 relative

set style fill transparent solid 0.4
set style line 1 lt rgb "#666666" lw 1 pt 6
set style line 2 lt rgb "#0000FF" lw 1 pt 6

unset key
unset mxtics
set xdata time 
set xtics format "%H:%M"
set ytics format "%2.0f"
set yrange [Ylow:Yhigh] 

plot dataFileForecast using 1:2 every ::1 title column with filledcurve above y1=0 ls 1,\
     dataFileForecast using 1:2:2 every ::1 with labels offset 0,1 tc "#FFFFFF" font "Lato-Light,8",\
     freezeWarning with filledcurve above y1=0 ls 2

工作正常,但由于某种原因我丢失了第一个数据点(绘图应以 07:00 开头,并显示 24 个数据点):

我不知道如何让绘图从第一个数据点开始。 (完成后,我真正想做的是在两边放置一个 1 小时的缓冲区——换句话说,让 xrange 为 [dataPoint1-(60*60):dataPoint24+(60*60)]

如有任何帮助,我们将不胜感激。

戴夫

使用 title column 告诉 gnuplot 使用第一行作为关键标题。有了这个,第一行就被跳过了。然后,every ::1 部分也会跳过第一行。将两者都删除,您将得到预期的情节。

要将 xrange 向每一侧延长 1 小时,请将 set offsets 60*60,60*60,0,0set autoscale xfix 一起使用:

reset

set terminal pngcairo enhanced background "#000000" font "Arial,10" size 600,200 truecolor
dataFileForecast = "test.dat"
set datafile separator ','
stats dataFileForecast using 2 nooutput

freezeWarning = 32
Yhigh = (STATS_mean * 1.5)
Ylow = (STATS_mean - (STATS_mean * 0.5))

set timefmt "%Y-%m-%d %H:%M"
set output "test.png"

set tics tc rgb "#666666"
set border lt rgb "#666666"
set boxwidth 0.25 relative

set style fill transparent solid 0.4
set style line 1 lt rgb "#666666" lw 1 pt 6
set style line 2 lt rgb "#0000FF" lw 1 pt 6

unset key
unset mxtics
set xdata time 
set xtics format "%H:%M"
set ytics format "%2.0f"
set yrange [Ylow:Yhigh]
set autoscale xfix
set offsets 60*60,60*60,0,0

plot dataFileForecast using 1:2 with filledcurve above y1=0 ls 1,\
     dataFileForecast using 1:2:2 with labels offset 0,1 tc "#FFFFFF" font "Lato-Light,8",\
     freezeWarning with filledcurve above y1=0 ls 2