Question

To say this is frustrating is putting it mildly. My sample data looks like so:

2012-04-30 20:00,1.32412,1.32412,1.32376,1.3239
2012-04-30 20:15,1.3239,1.32416,1.32378,1.32388
2012-04-30 20:30,1.32388,1.3241,1.32388,1.324
2012-04-30 20:45,1.324,1.32405,1.32385,1.32385
...

Where the fields are:

Date/Time,Open,High,Low,Close

My Gnuplot script for plotting this is simply:

set xdata time
set timefmt "%y-%m-%d %H:%M"
set format x "%m/%d\n%H:%M"
set xrange ["2012-05-01 00:00":"2012-05-01 08:00"]
set yrange [*:*]
set grid
set key left
set datafile separator ","
plot 'data.csv' using 1:2:4:3:5 notitle with candlesticks

As you can see, I'm adjusting the column data to match the order that the candlesticks plot is expecting. My data ranges from 2012-04-30 to 2012-05-31, so I'm only trying to plot 8 hours worth of data to start. I have tried to set the xrange to [*:*], but that only causes things to turn out worse. Any help would be greatly appreciated.

Was it helpful?

Solution

So the problem was in the timefmt section. Since I am using a 4-digit year, I needed to use %Y and not %y, i.e. case matters. Hopefully this will clear things up for anyone else who is running into this strangeness.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top