Can you set timefmt one way for X and another for Y? My data looks like:
2019-05-08 00:14:29.000
2019-05-08 00:14:27.000
2019-05-07 22:08:09.000
2019-05-07 22:08:08.000
My code looks like:
## X axis
set xdata time
set timefmt "%Y-%m-%d"
set format x "%m:%d"
set xrange ["2019-01-01":"2019-10-30"]
set xlabel "Date (mm:dd)" font "Times, 12"
# Y axis
set ydata time
set timefmt "%H:%M:%S"
set format y "%H:%M"
set yrange ["00:00":"23:59"]
set ylabel "Time Of Day(hh:mm)" font "Times, 12"
plot "file.data" using 1:2 with points
I see the axes look right but there is no data. If I remove the second 'set timefmt' it complains about no Y data.
I didn't see an example of this using gnuplot. Any suggestions? I have many hundreds of datapoints and 50+ files of data.
I'm also regularly confused and puzzled with data/time format. My suspicion is that if you have two time axes you specify the input format first set timefmt "%Y-%m-%d"
and later set timefmt "%H:%M:%S"
. This is not especially dedicated to an axis. So, when it comes to plotting, gnuplot takes the current (the latter) format which is of course wrong for the date in column 1. But I could be wrong with this explanation.
Anyway, if you specify the format in the plot command (timecolumn(1,"%Y-%m-%d"))
it should be fine.
Code:
### two date/time axes
reset session
$Data <<EOD
2019-01-08 10:14:29.000
2019-05-08 00:14:27.000
2019-05-07 14:08:09.000
2019-05-07 22:08:08.000
2019-10-07 12:08:08.000
EOD
## X axis
set xdata time
set timefmt "%Y-%m-%d"
set format x "%m/%d"
set xrange ["2019-01-01":"2019-10-30"]
set xlabel "Date (mm/dd)" font "Times, 12"
# Y axis
set ydata time
set timefmt "%H:%M:%S"
set format y "%H:%M"
set yrange ["00:00":"23:59"]
set ylabel "Time Of Day(hh:mm)" font "Times, 12"
plot $Data using (timecolumn(1,"%Y-%m-%d")):2 w p pt 7
### end of code
Result: