Skip to content

Instantly share code, notes, and snippets.

@eswdd
Created January 30, 2014 09:30
Show Gist options
  • Save eswdd/8705282 to your computer and use it in GitHub Desktop.
Save eswdd/8705282 to your computer and use it in GitHub Desktop.
timelines in gnuplot / html
1 2010-01-01 2010-01-31 2010-02-31
2 2011-01-01 2011-01-31 2010-02-31
3 2012-01-01 2012-01-31 2010-02-31
11 2010-01-01 2010-01-31 2010-02-31
12 2011-01-01 2011-01-31 2011-02-31
13 2012-01-01 2012-01-31 2012-02-31
set datafile separator ","
set terminal png size 600,800
set output 'Generated.png'
# input Y data as date values
set ydata time
set timefmt "%Y-%m-%d"
# y coordinates now specified in time values
set yrange ['2010-01-01':'2014-01-01']
# normal Y axis labels end up on top of graph, don't want that
unset ytics
# format y2 axis for time scale, this will appear along bottom of graph
set y2data time
set format y2 "%b/%Y"
set y2tics rotate by 90
# x axis becomes y axis
set xrange [-5:20]
unset xtics
unset key
# labels
set label 'item1' at 0,'2013-07-01' rotate
set label 'item2' at 10,'2013-07-01' rotate
# plot
set style fill transparent solid 0.5 noborder
plot "data.csv" using 1:2:2:3:3:xticlabels(2) with candlesticks lc rgb"red", \
"data.csv" using 1:3:3:4:4:xticlabels(2) with candlesticks lc rgb"black"
<p style="height: 600px"><img src="Generated.png" style="-webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); margin-left: 150px; margin-top: -100px" /></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment