Re: columns with time format as "y"

Ethan Merritt <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.user
Message-ID <1969402.vDIJYsGffo@stonelion>
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
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.