Search code examples
pythonprecisiongnuplot

gnuplot alternative with higher time precision


At present I'm using gnuplot to plot data against a time line. However the precision of the time line is in milliseconds but gnuplot only seems to be able to handle seconds.

I've looked at a couple of alternatives, but really I just need something like gnuplot that can cope with fractions of a second.

The programming language used for the main script is Python and whilst I've looked at matplotlib, it seems to be a lot more 'heavy duty' than gnuplot. As I won't always be the one updating the graphing side of things, I want to keep it as easy as possible.

Any suggestions?

Update

I'm using this with gnuplot:

set xdata time
set timefmt "%Y-%m-%d-%H:%M:%S"

However there is no %f to get milliseconds. For example, this works:

2011-01-01-09:00:01

but I need:

2011-01-01-09:00:01.123456

Solution

  • You can set the ticks format with

    set format x '%.6f'
    

    or (maybe, I have not tried it, as I now prefer to use Matplotlib and do not have gnuplot installed on my machines):

    set timefmt "%Y-%m-%d-%H:%M:%.6S"
    

    (note the number of digits specified along with the %S format string).

    More details can be found in the excellent not so Frequently Asked Questions.