2014-06-06 40 views
1

一直在使用烛台上的真实财务数据。除非我在数据方面存在差距,否则它的效果很好,历史财务数据有很多差距。Gnuplot烛台和盒宽

我有“设置箱宽1相对”,它工作正常,它给了我一个在大多数情况下烛台适当的“宽度”。但是,如果两点之间没有数据,烛台将变得更加肥厚,也就是说它正好弥补了这一差距。视觉是可怕的,向右延伸是非常糟糕的。

我已经尝试玩设置boxwidth x绝对,但我不能在它是如何显示条款。我已经缩小到set boxwidth 37500 absolute,并且不知道为什么这个数字能够工作,尽管它的设置框宽度1相对更有问题。

第一张图像是使用set boxwidth 37500 absolute时的样子。日期从01/31/13,02/01/13,02/03/13,02/04/13,02/05/13。没有13年2月2日:

enter image description here

绝对显示了原因,我无法解释02/01 02/02和02/03,但和02/04重叠之间的适当的间隙。

第二张图片使用设置框宽1相对。这主要是我想要的方式。烛台相邻,大部分都是正确的。但是,在02/02/13的差距它肥胖的权利。在2013年9月2日还有一个缺口,它也会变胖,或者两边可能会延长以弥补我不知道的差距。

enter image description here

我如何配置,从而使所有的烛台都是相同的宽度和相邻的数据差距是空的?

我把这个用起来很疯狂,没有人会谈论它。我发现的烛台的几个例子不使用“日期”,而是整数,完全没有价值。烛台图表需要每个手册的日期。

在Windows 7

运行的Gnuplot 4.6 PATCHLEVEL 0谢谢

PS:我应该在这里添加的数据去。

basic.csv

2013-01-15 00:00:00,93.879000,93.949000,92.874000,93.078000 
2013-01-16 00:00:00,93.079000,93.672000,92.458000,92.800000 
2013-01-17 00:00:00,92.799000,95.011000,92.629000,94.616000 
2013-01-18 00:00:00,94.617000,94.872000,94.157000,94.662000 
2013-01-20 17:00:00,94.649000,94.820000,93.965000,94.155000 
2013-01-21 00:00:00,94.159000,94.938000,93.726000,94.009000 
2013-01-22 00:00:00,94.011000,94.284000,93.147000,93.231000 
2013-01-23 00:00:00,93.229000,94.024000,92.793000,93.649000 
2013-01-24 00:00:00,93.650000,94.715000,93.559000,94.489000 
2013-01-25 00:00:00,94.490000,95.083000,94.472000,94.749000 
2013-01-27 17:00:00,94.819000,95.007000,94.652000,94.834000 
2013-01-28 00:00:00,94.835000,94.968000,94.082000,94.809000 
2013-01-29 00:00:00,94.803000,95.330000,94.370000,95.248000 
2013-01-30 00:00:00,95.245000,95.450000,94.255000,94.365000 
2013-01-31 00:00:00,94.372000,95.799000,94.328000,95.714000 
2013-02-01 00:00:00,95.715000,96.718000,95.457000,96.597000 
2013-02-03 17:00:00,96.716000,96.777000,96.370000,96.572000 
2013-02-04 00:00:00,96.574000,97.064000,95.968000,96.044000 
2013-02-05 00:00:00,96.043000,97.426000,95.945000,97.131000 
2013-02-06 00:00:00,97.133000,97.284000,96.092000,96.395000 
2013-02-07 00:00:00,96.396000,97.023000,95.813000,96.145000 
2013-02-08 00:00:00,96.146000,96.182000,95.124000,95.625000 
2013-02-10 17:00:00,95.623000,95.744000,95.210000,95.339000 
2013-02-11 00:00:00,95.336000,96.877000,95.168000,96.537000 
2013-02-12 00:00:00,96.536000,96.719000,95.776000,96.214000 
2013-02-13 00:00:00,96.216000,96.890000,96.114000,96.775000 
2013-02-14 00:00:00,96.771000,96.964000,95.609000,95.621000 
2013-02-15 00:00:00,95.622000,96.676000,95.521000,96.351000 

absolute.plt

reset 

set border linecolor rgbcolor "yellow" 
set key textcolor rgbcolor "white" 

set obj 1 rectangle behind from screen 0,0 to screen 1,1 
set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "black" 

set xdata time 
set timefmt"%Y-%m-%d %H:%M:%S" 
set xrange ["2013-01-15 00:00:00":"2013-02-15 23:59:59"] 

set yrange [*:*] 
set datafile separator "," 

set palette defined (-1 'red', 1 'green') 
set cbrange [-1:1] 
unset colorbox 

set style fill solid noborder 
set boxwidth 37500 absolute 

set title "AUDJPY" textcolor rgbcolor "white" 
plot 'basic.csv' using 1:2:4:3:5:($5 < $2 ? -1 : 1) with candlesticks palette 

relative.plt

reset 

set border linecolor rgbcolor "yellow" 
set key textcolor rgbcolor "white" 

set obj 1 rectangle behind from screen 0,0 to screen 1,1 
set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "black" 

set xdata time 
set timefmt"%Y-%m-%d %H:%M:%S" 
set xrange ["2013-01-15 00:00:00":"2013-02-15 23:59:59"] 

set yrange [*:*] 
set datafile separator "," 

set palette defined (-1 'red', 1 'green') 
set cbrange [-1:1] 
unset colorbox 

set style fill solid noborder 
set boxwidth 1 relative 

set title "AUDJPY" textcolor rgbcolor "white" 
plot 'basic.csv' using 1:2:4:3:5:($5 < $2 ? -1 : 1) with candlesticks palette 

回答

4

当使用set boxwidth absolute,宽度在x轴的单位给出,这在日期的情况是秒。所以,宽度37500是10个小时。

您也可以在第6列中使用显式宽度,并切换到-2以获得某些列的自动框宽度。然而,这需要你手动操作你的数据文件。

另一点:你是否有必要在一些数据点中加入小时?这是缩小了一些相邻点的距离。你可以忽略小时,这会给你一个最短的一天的点距离。剥去小时,在using语句中使用strptime

reset 

set border linecolor rgbcolor "yellow" 
set key textcolor rgbcolor "white" 

set obj 1 rectangle behind from screen 0,0 to screen 1,1 
set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "black" 

set xdata time 
set timefmt"%Y-%m-%d %H:%M:%S" 
set xrange ["2013-01-15 00:00:00":"2013-02-15 23:59:59"] 

set yrange [*:*] 
set datafile separator "," 

set palette defined (-1 'red', 1 'green') 
set cbrange [-1:1] 
unset colorbox 

set style fill solid noborder 
set boxwidth 60000 absolute 

set title "AUDJPY" textcolor rgbcolor "white" 
plot 'basic.csv' using (strptime('%Y-%m-%d', strcol(1))):2:4:3:5:($5 < $2 ? -1 : 1) with candlesticks palette 

结果与4.6.0:

enter image description here

+0

谢谢我看了看文档和不能确定它是在几秒钟。 – Bodger