2
votes

I'm collecting pricing data on stocks and options during trading hours and appending them to a data file that I plot with gnuplot. The file looks like:

2013-01-30--15:58:14 38.68 0.64
2013-01-30--15:58:44 38.70 0.64
2013-01-30--15:59:15 38.70 0.64
2013-01-30--15:59:45 38.69 0.64

I end up with large periods of time that I don't collect any data for since the markets are closed.

When I plot this data with gnuplot, using xdata as timefmt, it displays large gaps from the end of one day to the start of another.

I'd prefer to have it skip those times during the days where there is no actual data... Is there a way to do this?

I've been able to come close by not plotting the data against the time value in the first column, but I'd like to show the time data AS WELL AS skip those times when the data was not collected.

I hope this makes sense and appreciate your help.

1

1 Answers

3
votes

If I understood correctly, you can make good use of a broken axis on x.

There are two ways to obtain broken axis. The first one relies on ternary operators to plot the data only in the region of your interest, which in your case should not even be necessary, and shifting the xtics left in order to reduce the dimension of the empty region. This is a nice tutorial:

http://gnuplot-tricks.blogspot.com/2009/06/broken-axis-revisited.html

The second one makes uses of multiplots instead. This is probably better suit to your needs.

http://gnuplot-tricks.blogspot.com/2010/06/broken-axis-once-more.html

Hope it helps.