Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

format x axis as date/time

17 views
Skip to first unread message

Randy Wilkinson

unread,
Dec 7, 2021, 6:50:58 PM12/7/21
to
I am trying to figure out how to format the x axis of my plot using date and time. I have sensor measurement readings that are recorded every few minutes over multiple days.

My data file looks like this excerpt:

11/19/2021 11:36:01,717.9,70.2,33.4
11/19/2021 11:42:01,701.5,70.8,33.6
11/19/2021 11:48:01,692.5,71.2,32.7
11/19/2021 11:54:01,695.4,71.3,32.0
11/19/2021 12:00:01,699.8,71.4,31.5
11/19/2021 12:06:01,698.9,71.7,31.1
11/19/2021 12:12:01,697.3,71.9,30.7
11/19/2021 12:18:01,711.6,72.1,30.5
11/19/2021 12:24:01,765.9,72.3,30.3
11/19/2021 12:30:01,747.0,73.7,29.0
.
.
.

My gnuplot settings are currently like this:

set datafile separator comma
set title "CO2 Measurements" font ",20"
set xdata time
set timefmt "%m/%d/%Y %H:%M:%S"
set y2range [32:100]
set autoscale y
#set autoscale y2
set format x "%m/%d/%Y %H:%M"
set ylabel "CO2, PPM"
set y2label "Temperature, Degrees F"
set grid
set border
set style data lines
plot 'CO2logfile-25Nov21.csv' using 0:2, '' using 0:3, '' using 0:4

It looks like plot does not ready the time correctly from my data file. It seems to only be reading the seconds. I'd like the x axis to indicate the date and time for measurements from the data file.

Any suggestions appreciated! Randy

Jörg Buchholz

unread,
Dec 8, 2021, 1:51:48 AM12/8/21
to

On 08.12.2021 00:50, Randy Wilkinson wrote:

> plot 'CO2logfile-25Nov21.csv' using 0:2, '' using 0:3, '' using 0:4
>
> It looks like plot does not ready the time correctly from my data
> file. It seems to only be reading the seconds. I'd like the x axis
> to indicate the date and time for measurements from the data file.
>
> Any suggestions appreciated! Randy
>


column 0 is a "pseudo-column", your date is in column 1.

Jörg

Randy Wilkinson

unread,
Dec 8, 2021, 9:53:48 AM12/8/21
to
I thought I tried that. It works as expected using column 1 instead of 0. Thanks! Getting out the docs to find out what a pseudo-column is....Randy
0 new messages