问题描述
n = 20
hgt = rand(n) .+ 1
bot = randn(n)
openpct = rand(n)
closepct = rand(n)
y = OHLC[(openpct[i] * hgt[i] + bot[i],bot[i] + hgt[i],bot[i],closepct[i] * hgt[i] + bot[i]) for i = 1:n]
ohlc(y)
通过属性检查,我看到了标记,但有没有办法在定义的索引位置为特定条着色?假设我在 x 轴索引位置 11 和 15 处将这些 2x 条着色为黄色以进行输出:
解决方法
可能有更好的方法来做到这一点,但你可以得到
与
julia> ohlc(y)
julia> ohlc!(OHLC[i ∈ (11,15) ? y[i] : OHLC(NaN,NaN,NaN) for i in eachindex(y)],c=:red)