Re: columns with time format as "y"

"t.sefzick" <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.user
Message-ID <[email protected]>
The separator of your data is the comma, so

set datafile separator comma

splits your data into

<empty> date time value1 value2

Because of the empty first column you need to start
with column 2:

set timefmt "%Y-%m-%d,%H:%M:%S"
plot "datafile.dat" using 2:4

On Mon, Apr 20, 2020 at 08:00:02PM +0000, John L. Males wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> As follow on to the OP question I have data format of the form:
>
> ,2019-04-16,20:30:00,30522,5
> ,2019-04-16,20:31:00,30523,6
> ,2019-04-16,20:32:00,30524,7
> ,2019-04-16,20:33:00,30525,8
> ,2019-04-16,20:34:00,30526,9
> ,2019-04-16,20:35:00,30527,10
> ,2019-04-16,20:36:00,30528,11
> ,2019-04-16,20:37:00,30529,12
> ,2019-04-16,20:38:00,30530,13
> ,2019-04-16,20:39:00,30531,14
>
> Yes, the data lines start with "," for reasons I will skip
> other than to say this is the data by design.
>
> I had tried a:
>
> set timefmt ",%Y-%m-%d,%H:%M:%S"
>
> a few years ago and again a few months ago with no success.
> Just an error message to effect of invalid time format in
> data.  I have had to add extra external step to filter the
> data.  The issue is the data is very large so it adds a couple
> minutes to filter the data before I can input the date to
> gnuplot.  I really would like to eliminate the data filter step
> that eliminates the leading comma of the data as this data is
> processed every 15 minutes for now as I cannot filter the data
> every 5 minutes due to the added filtering step that then uses:
>
> set timefmt "%Y-%m-%d,%H:%M:%S"
>
>
> John L. Males
> Toronto, Ontario
> Canada
> 20 April 2020 16:00 -0400 EDT
>
>
> ================================================================
>
> 2020-04-20 19:45:51+0000-UTC Time: 1587411951 PC/System time
>
> 20 Apr 19:45:51 ntpdate[64207]: ntpdate 4.2.8p12-a (1)
>
> 20 Apr 19:46:06 ntpdate[65654]: step time server
> 128.100.100.128 offset 0.003394 sec
>
> FreeBSD 11.3-STABLE FreeBSD 11.3-STABLE #0 r349903: Thu Jul 11
> 16:13:47 UTC 2019
> [email protected]:/usr/obj/usr/src/sys/GENERIC
>
> (Work in progress alternative to Linux Kernel of its own right,
>  Debian, and
>  other Linux based Kernel distributions determined.)
>
> Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
> Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz (1396.86-MHz K8-class
> CPU) Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz (1396.86-MHz
> K8-class CPU) Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz
> (1396.86-MHz K8-class CPU) Intel(R) Core(TM) i3-2367M CPU @
> 1.40GHz (1396.86-MHz K8-class CPU) Intel(R) Core(TM) i3-2367M
> CPU @ 1.40GHz (1396.86-MHz K8-class CPU)
>
> dev.cpu.0.temperature: 73.0C
> dev.cpu.1.temperature: 73.0C
> dev.cpu.2.temperature: 69.0C
> dev.cpu.3.temperature: 69.0C
> hw.acpi.thermal.tz0.temperature: 75.1C
>
> vmstat -s:
>
>  83430749 cpu context switches
>   1277504 device interrupts
>    368458 software interrupts
>  31639133 traps
> 264899647 system calls
>        27 kernel threads created
>      1920  fork() calls
>       596 vfork() calls
>         0 rfork() calls
>         0 swap pager pageins
>         0 swap pager pages paged in
>         0 swap pager pageouts
>         0 swap pager pages paged out
>      6321 vnode pager pageins
>     73954 vnode pager pages paged in
>       107 vnode pager pageouts
>       107 vnode pager pages paged out
>         0 page daemon wakeups
>  12090933 pages examined by the page daemon
>         0 clean page reclamation shortfalls
>         0 pages reactivated by the page daemon
>    113093 copy-on-write faults
>       463 copy-on-write optimized faults
>  28402363 zero fill pages zeroed
>         0 zero fill pages prezeroed
>        48 intransit blocking page faults
>  32157102 total VM faults taken
>      6075 page faults requiring I/O
>         0 pages affected by kernel thread creation
>     93134 pages affected by  fork()
>     20968 pages affected by vfork()
>         0 pages affected by rfork()
>  29860181 pages freed
>         0 pages freed by daemon
>  14599509 pages freed by exiting processes
>    344499 pages active
>   1010164 pages inactive
>     76679 pages in the laundry queue
>    262762 pages wired down
>   2358662 pages free
>      4096 bytes per page
>   4907338 total name lookups
>           cache hits (96% pos + 1% neg) system 0% per-directory
>           deletions 0%, falsehits 0%, toolong 0%
>
> Boot time : 1587398332
>
> procs     memory        page                    disks
> faults        cpu0     cpu1     cpu2     cpu3 r b w     avm
> fre  flt  re  pi  po    fr   sr ad0 pa0   in    sy    cs us sy
> id us sy id us sy id us sy id 0 0 0 30655696 9434572 2359   0
> 0   0  2190  887   0   0   94 19431  6120 13  4 83 13  4 83 13
> 4 83 13  4 83
>
> memory info:
>
> real memory  = 17179869184 (16384 MB)
> avail memory = 16495013888 (15730 MB)
>
> last pid: 71600;  load averages:  0.53,  0.79,  0.81  up
> 0+03:47:14    19:46:06 53 processes:  1 running, 52 sleeping
>
> Mem: 1346M Active, 3946M Inact, 300M Laundry, 1027M Wired, 442M
> Buf, 9213M Free Swap: 48G Total, 48G Free
>
> hw.physmem: 17053859840
> hw.usermem: 15977410560
> hw.realmem: 17179869184
>
>              total       used       free     shared
> buffers     cached Mem:      16210872    2735676
> 13475196          0          0          0 Swap:
> 50331644          0   50331644
>
> swapinfo:
>
> Device          1K-blocks     Used    Avail Capacity
> /dev/ada0s1b     50331644        0 50331644     0%
>
> vmstat:
>
> procs     memory        page                    disks
> faults         cpu r b w     avm     fre  flt  re  pi  po
> fr   sr ad0 pa0   in    sy    cs us sy id 0 0 0 30655696
> 9434576 2359   0   0   0  2190  887   0   0   94 19430  6120
> 13  4 83
>
>
> Message replied to:
>
> Date: Mon, 20 Apr 2020 12:00:40 -0700
> From: Ethan Merritt <[email protected]>
> To: [email protected]
> Subject: Re: [Gnuplot-info] columns with time format as "y"
>
>
> > On Monday, 20 April 2020 11:30:03 PDT [email protected] wrote:
> > >
> > > Hello All,
> > >
> > > I need help with the following problem:
> > >
> > > Let's say my input data look like (columns delimited by \t):
> > >
> > >    2019-04-16 20:30:00	30522	5
> > >    2019-04-16 20:31:00	30523	6
> > >    2019-04-16 20:32:00	30524	7
> > >    2019-04-16 20:33:00	30525	8
> > >    2019-04-16 20:34:00	30526	9
> > >    2019-04-16 20:35:00	30527	10
> > >    2019-04-16 20:36:00	30528	11
> > >    2019-04-16 20:37:00	30529	12
> > >    2019-04-16 20:38:00	30530	13
> > >    2019-04-16 20:39:00	30531	14
> > >
> > > Column 1 & 2 (space separated) considered as date/time.
> > >
> > > Plotting Col. 3 or 4 against date/time works fine:
> > >
> > >    set xdata time
> > >    set timefmt "%Y-%m-%d\t%H:%M:%S"
> > >    set format x "%d.%m. %H:%M"
> > >    plot 'my_file.txt' using 1:3 title "col 3" axis x1y1
> > > with linespoints pt7 lc 4, '' using 1:4 title "col 4" axis
> > > x1y1 with linespoints pt7 lc 7
> > >
> > > Special feature: Although columns 1 and 2 *together* give
> > > the timestamp, only "1:..." is given for "using" statement.
> > > This method is often found in examples.
> > >
> > > But now I would like - don't ask me why - to plot the
> > > timestamp against column 3, i.e. column 3 as "x" and the
> > > timestamp (columns 1 & 2) as "y".
> > >
> > > I was trying:
> > >
> > >    set ydata time "%Y-%m-%d\t%H:%M:%S"
> > >    set timefmt "%Y-%m-%d\t%H:%M:%S"
> > >    set format y "%d.%m. %H:%M"
> > >    plot 'my_file.txt' using 3:1 title "col 3" axis x1y1 with
> > >      linespoints pt7 lc 4
> > >
> > > Result: only date is used for plotting "y", time ignored!
> >
> > Replace the tab with a space in timefmt:
> >
> >     set timefmt "%Y-%m-%d %H:%M:%S"
> >
> > The space character in the format will match any whitespace
> > sequence, including <tab>.
> >
> > 	Ethan
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > gnuplot-info mailing list
> > [email protected]
> > Membership management via:
> > https://lists.sourceforge.net/lists/listinfo/gnuplot-info
> -----BEGIN PGP SIGNATURE-----
>
> iF0EARECAB0WIQQxRId2q5JPHFiozTr5X9dS0HpoEAUCXp3/QwAKCRD5X9dS0Hpo
> EAx0AJ464SqTe0oieSwe8My/Yc6XCKHS7ACg2wPr2cEnr89Hg1SLbwB+LfpUVUE=
> =czcZ
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> gnuplot-info mailing list
> [email protected]
> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info


_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.