JiggidyJoe
JiggidyJoe

Reputation: 519

gnuplot stock chart using date on x axis

I am trying to use gnuplot for the first time. I am completely new to gnuplot. Please forgive any basic mistakes. I am trying to plot a stock chart. My data looks like the following:

Date Open High Low Close
21/04/2017 31.81 32.09 31.67 31.95
20/04/2017 31.55 32.02 31.45 31.91
19/04/2017 31.3 31.71 30.99 31.57
18/04/2017 31.78 31.84 31.06 31.3
17/04/2017 31.3 31.97 31.21 31.8
13/04/2017 31.26 31.48 31.16 31.19
12/04/2017 31.13 31.38 30.98 31.24
11/04/2017 31.37 31.66 30.86 31.2

I am using the following settings to plot the lines. I got them from another website.

set xdata time
set timefmt "%d/%m/%Y"
set xrange ["21/04/2015":"21/04/2017"]
set format x "%d/%m/%Y"
plot [0:100] 'chart.dat' using 0:2:3:4:5 notitle with financebars

However, the x-axis just has 01/01/1970. See attached pic. chart.png

Any assistance would be greatly appreciated. Thanks.

Upvotes: 0

Views: 576

Answers (1)

maij
maij

Reputation: 4218

The plot command plot [0:100] ... using 0:2:3:4:5 takes column 0 for x, column 0 corresponds to the line number instead of the time column.

This command should work:

plot 'chart.dat' using 1:2:3:4:5 notitle with financebars

Upvotes: 1

Related Questions