user3421997
user3421997

Reputation: 53

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!" 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

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

Upvotes: 0

Views: 1183

Answers (1)

Zahaib Akhtar
Zahaib Akhtar

Reputation: 1078

The problem is with how you've defined your timefmt in the gnuplot script versus how it is actually in the data file:

You will need to change timefmt so that it matches that in your data file

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

And then set xrange similarly. 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']

Upvotes: 1

Related Questions