简体   繁体   English

在gnuplot中从csv文件绘制时间序列数据会返回错误

[英]plotting time series data from a csv file in gnuplot returns an error

I'm trying to plot time series data from a csv file but always get an error that says "all points y value undefined!" 我正在尝试从csv文件中绘制时间序列数据,但始终会收到一条错误消息:“所有点y值未定义!” I'm not sure what I'm doing wrong with the following commands I issue 我不确定我发出的以下命令在做什么错

set datafile separator ','
set xdata time
set timefmt '%m/%d/%Y %H:%M:%S'               
set format x '%H:%M'
set autoscale y
set xrange ['07/01/2014':'07/10/2014']
plot 'data.csv' u 3:4 w lines

the data in the csv file looks like below CSV文件中的数据如下所示

sensor name,server name,2014-07-01 20:11:48,16.44954,V,valuetype
sensor name,server name,2014-07-01 20:12:08,16.48951,V,valuetype
sensor name,server name,2014-07-01 20:12:18,16.53948,v,valuetype

The problem is with how you've defined your timefmt in the gnuplot script versus how it is actually in the data file: 问题在于您如何在gnuplot脚本中定义timefmt以及实际在数据文件中的定义:

You will need to change timefmt so that it matches that in your data file 您将需要更改timefmt ,使其与数据文件中的匹配

set timefmt '%Y-%m-%d %H:%M:%S' 

And then set xrange similarly. 然后类似地设置xrange Following is tailored to the data you've provided. 以下内容是针对您提供的数据量身定制的。 You may change the values to suite your complete data: 您可以更改值以适合您的完整数据:

set xrange ['2014-07-01 20:11:00':'2014-07-01 20:12:20']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM