Remove weekend gaps in gnuplot for candlestick chart

大城市里の小女人 提交于 2019-12-01 23:01:17
Joce

As you have one entry per working day, instead of using the dates as abscissae you can use the line number:

plot 'head.dat' using 0:2:4:3:5 notitle with candlesticks

Then I guess you'll ask how to restore the dates on the x-axis. You can use xticslabel :

set xtics rotate 90
plot "head.dat" u 0:2:4:3:5:xticlabels(1) notitle with candlesticks

If you want to avoid having every label shown use this everyNth function posted by dir, e.g. every fifth label:

set datafile separator ","
everyNth(countColumn, labelColumnNum, N) = \
  ( (int(column(countColumn)) % N == 0) ? stringcolumn(labelColumnNum) : "" ) 
set xtics rotate 90
plot "head.dat" using 0:2:4:3:5:xticlabels(everyNth(0, 1, 5)) notitle with candlesticks

Results in:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!