Gnuplot日期vs日期
如何在gnuplot中绘制以下数据:Gnuplot日期vs日期,gnuplot,Gnuplot,如何在gnuplot中绘制以下数据: 101,2018,116,1500,3.457 101,2018,116,1515,3.456 101,2018,116,1530,3.458 101,2018,116,1545,3.458 101,2018,116,1600,3.457 我需要绘制数据(第5列)和时间(第2、3和4列)。第2列为年份,第3列为朱利安日,第4列为HHMM。这是我试过的 set xdata time set timefmt "%Y,%j,%H%M" set xrange ["
101,2018,116,1500,3.457
101,2018,116,1515,3.456
101,2018,116,1530,3.458
101,2018,116,1545,3.458
101,2018,116,1600,3.457
我需要绘制数据(第5列)和时间(第2、3和4列)。第2列为年份,第3列为朱利安日,第4列为HHMM。这是我试过的
set xdata time
set timefmt "%Y,%j,%H%M"
set xrange ["1/15/2018":"8/02/2018"]
set yrange [0:5]
plot 'du1piezometerslong050318.dat' using 2:5 title 'July time series' with lp lw 4 pt 7 ps 0.75
默认情况下,gnuplot需要空间分隔的数据。因此,您需要:
set datafile separator ","
那么输入数据中的第116天是4月26日,所以1月到2月的xrange不包括这一天。指定xrange的格式应与timefmt(年、日、小时/分钟)相同:
yrange可以工作,但是太大了,无法真正看到差异,不设置yrange并让gnuplot自己解决可能没问题
最后的gnuplot脚本是:
set xdata time
set timefmt "%Y,%j,%H%M"
set xrange ["2018,116,1500":"2018,116,1600"]
set datafile separator ","
plot 'data.dat' using 2:5 title 'time series' with lp lw 4 pt 7 ps 0.75
set xdata time
set timefmt "%Y,%j,%H%M"
set xrange ["2018,116,1500":"2018,116,1600"]
set datafile separator ","
plot 'data.dat' using 2:5 title 'time series' with lp lw 4 pt 7 ps 0.75
#specify that our columns are separated with ','
set datafile separator ","
set xdata time
set timefmt "%Y,%j,%H%M"
#specify the output formatting of the x-tics
set format x "%Y-%m-%d"
#set xrange in a format compatible with 'timefmt' above
set xrange ["2018,116,0000":"2018,117,0000"]
set yrange [0:5]
#assembly the specified timefmt from input columns
plot 'test.dat' using (sprintf('%04d,%03d,%04d',$2,$3,$4)):5 w lp