Gnuplot-User-Error:“所有点y值未定义!”

Gnuplot-User-Error:“所有点y值未定义!”,gnuplot,Gnuplot,这是我的节目。我正在尝试绘制格式对我来说很好的数据。Gnuplot拒绝绘制数据,称y值未定义。我做错了什么 set output "snowData.png" set title "Data from Weather Station Yard" set xdata time set timefmt "%H:%M" set format x "%H" set xrange [00:24] set xtics set xlabel "Time(hrs)" set ylabel "Water

这是我的节目。我正在尝试绘制格式对我来说很好的数据。Gnuplot拒绝绘制数据,称y值未定义。我做错了什么

set output "snowData.png"
set title  "Data from Weather Station Yard"
set xdata time 
set timefmt "%H:%M"
set format x "%H"
set xrange [00:24]
set xtics  
set xlabel "Time(hrs)"
set ylabel "Water Content(inches)" tc lt 1      
set y2label "Temperature Deg F" tc lt 2
set grid
#set yrange  [0:2]
#set y2range [-20:80]
#set autoscale y2
set ytics 1 nomirror tc lt 1 
set y2tics 10 nomirror tc lt 2      #MUST set y2tics to view y2label

plot "logSnow.dat" using 1:2 title "Water Content(inches)" with linespoints linetype 1,
\"logSnow.dat" using 1:3 title "Temperature" with linespoints linetype 2    

Here is my data:
2019:02:20:10:55 -0.01,70.14,3.90
2019:02:20:11:26 -0.01,70.59,3.90
2019:02:20:11:57 -0.01,70.36,3.90
两个问题:

您的数据以逗号分隔。所以,你漏掉了一行

设置数据文件分隔符

xrange需要格式为%H:%M的时间字符串

设置X范围[00:00:24:00]

有了这个,它应该会起作用

以下代码给出了gnuplot 5.2.5下面的图表:

### plotting time data
reset session

$Data <<EOD
2019:02:20:10:55,-0.01,70.14,3.90
2019:02:20:11:26,-0.01,70.59,3.90
2019:02:20:11:57,-0.01,70.36,3.90
EOD

set datafile separator ","
set xdata time 
set timefmt "%Y:%m:%d:%H:%M"
set format x "%H"
set xrange ["2019:02:20:00:00":"2019:02:20:24:00"]

plot $Data u 1:2 w lp lt 1 ti "Water Content(inches)" ,\
     $Data u 1:3 w lp lt 2 ti "Temperature"
### end of code

我无法获取要列中列出的数据。00:02,-0.01,67.21,4.01是第一条记录。你的问题是什么?我的问题是如何获得要绘制的数据?我得到的只是没有数据点的图形轴。感谢您指出xrange格式中的错误。我在前面添加了datafile separator命令,但是新版本的gnuplot不需要这个cmd。显然,gnuplot需要时间信息之间的空间。和数据。无论如何,仍然没有绘制数据点。您更改了数据吗?您设置的时间mt%H:%M与您的时间数据2019:02:20:10:55不匹配。为此,格式可能应为%Y:%m:%d:%H:%m。哇!你显然发现了问题所在。我很想试试你的建议。它很管用!!非常感谢您抽出时间回答我的问题!