Treat axis as date/time (epoch)
Asked Answered
O

2

15

I'm generating a graph with gnuplot of activity over the last twenty four hours, but the time axis looks really bad because it's trying to fit the long number for every five minutes in the last day.

Is there any way for gnuplot to treat the x-axis as an epoch time, and mark every hour or so?

Olodort answered 20/11, 2009 at 1:24 Comment(3)
Do you want epoch time as the xtics or a formatted time/date?Mckinnon
I currently have the xtics as epoch time, I want them to be displayed as a formatted date time, preferably without rewriting the data file to have the formatted date/timeOlodort
Jeffrey, did my comment work for you?Cassowary
C
23

Is this what you want?

set xdata time
set timefmt "%s"
# set xtics 3600
set format x "%H:%M:%S" # or whatever
plot ...
Cassowary answered 9/12, 2009 at 5:52 Comment(3)
This gives me the error "Need full using spec for x time data"Olodort
Yeah, you will have to plot and use "using", so if you're plotting columns 1 and 2, do: "plot 'file' using 1:2 ... " instead of just "plot 'file' ..."Cassowary
Thanks, sorry I missed your comment before!Olodort
H
6

i followed this from the gnuplot howto :

03/21/95 10:00 6.02e23

This file can be plotted by

   set xdata time
   set timefmt "%m/%d/%y"
   set xrange ["03/21/95":"03/22/95"]
   set format x "%m/%d"
   set timefmt "%m/%d/%y %H:%M"
   plot "data" using 1:3
Heth answered 19/4, 2012 at 16:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.