消除gnuplot中的周末/非交易时间缺口

消除gnuplot中的周末/非交易时间缺口,plot,gnuplot,candlestick-chart,Plot,Gnuplot,Candlestick Chart,我的问题与相同,只是我正在为烛台使用条件着色,并且提到的解决方案不起作用 我的数据如下: 10/24/2018 23:45,168.25,168.65,168.2,168.4,0 10/24/2018 23:46,168.5,169,168.5,168.95,67577 10/24/2018 23:47,169.35,169.6,169.1,169.1,151630 10/24/2018 23:48,169.05,169.35,168.95,169.2,63418 . . 10/26/2018

我的问题与相同,只是我正在为烛台使用条件着色,并且提到的解决方案不起作用

我的数据如下:

10/24/2018 23:45,168.25,168.65,168.2,168.4,0
10/24/2018 23:46,168.5,169,168.5,168.95,67577
10/24/2018 23:47,169.35,169.6,169.1,169.1,151630
10/24/2018 23:48,169.05,169.35,168.95,169.2,63418
.
.
10/26/2018 13:48,169.05,169.35,168.95,169.2,63418
10/26/2018 23:47,169.35,169.6,169.1,169.1,151630
10/26/2018 23:48,169.05,169.35,168.95,169.2,63418
在gnuplot中使用以下命令打印如下文件:

使用timecolumn1打印…/ISTFeed.csv,%m/%d/%Y%H:%m:%S:2:3:4:5:$5<$2?rgb255,0,0:rgb0,255,0线条颜色rgb变量notitle带烛台


生成带有间隙的图表。我希望gnuplot省略这些间隙并连续绘制烛台。有没有办法做到这一点

看看下面的示例,其中包含生成的虚拟数据。尽管图中的XTIC看起来是等距的,但XTIC的值根本不是等距的。因此,如果你想读出两个XTIC之间的y值,你根本不知道实际的x值是什么。你只知道它一定在附近的XTIC之间。有点奇怪。。。但是如果你对这个精度没意见的话

代码:

结果:


如果所述链接的唯一区别是条件颜色,为什么要使用timecolumn0,%m/%d/%Y%H:%m:%S而不是答案中的0?如果省略日期/时间间隔,则x轴将不再是日期/时间轴,而是任意的数据线编号序列。你想要什么作为x轴tic标签,仍然是链接答案中的日期?@theozh时间列语法是因为gnuplot我认为不赞成旧格式。此外,它也更灵活。但是,我确实犯了一个有问题的小错误-我的意思是timecolumn1,%m/%d/%Y%H:%m:%S。是的,我确实希望XTIC是datetime。
### remove gaps in timedata
# requires gnuplot >=5.2, because of use of datablocks
reset session

# generate some dummy data
t = strptime("%m/%d/%Y %H:%M", "10/24/2018 23:45")
close = 168.25
set print $Data
print "#      date time,    open,     low,    high,   close"
do for [i=1:100] {
    open = close + (rand(0)*2)-1
    low_tmp = open - rand(0)
    high_tmp = open + rand(0)
    close = open + (rand(0)*2)-1
    low = open<low_tmp ? open : close<low_tmp ? close : low_tmp
    high = open>high_tmp ? open : close>high_tmp ? close : high_tmp
    dt = 3600*rand(0)*48
    t = t + dt
    print sprintf("%s,%8 .2f,%8 .2f,%8 .2f,%8 .2f",strftime("%m/%d/%Y %H:%M",t),open,low,high,close)
}
set print
print $Data

N = 10
Offset = 5
everyNthRow(N) = (int($0)%N==Offset ? word(strcol(1),1) : NaN)
set datafile separator ","
set xtics rotate by 45 right
set style fill solid 1.0
plot $Data u 0:2:3:4:5:($5<$2 ? 0xff0000 : 0x00ff00):xtic(everyNthRow(N)) w candlesticks lc rgb var not

### end of code