Fix vspan + move vline y values to shorthands
This commit is contained in:
parent
d827fa434c
commit
a2c0473244
@ -122,11 +122,9 @@ end
|
|||||||
@deps hline straightline
|
@deps hline straightline
|
||||||
|
|
||||||
@recipe function f(::Type{Val{:vline}}, x, y, z)
|
@recipe function f(::Type{Val{:vline}}, x, y, z)
|
||||||
n = length(x)
|
|
||||||
newx = vec(Float64[xi for i = 1:3, xi in x])
|
newx = vec(Float64[xi for i = 1:3, xi in x])
|
||||||
newy = repeat(Float64[1, 2, NaN], n)
|
|
||||||
x := newx
|
x := newx
|
||||||
y := newy
|
y := y
|
||||||
seriestype := :straightline
|
seriestype := :straightline
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
@ -145,9 +143,9 @@ end
|
|||||||
@deps hspan shape
|
@deps hspan shape
|
||||||
|
|
||||||
@recipe function f(::Type{Val{:vspan}}, x, y, z)
|
@recipe function f(::Type{Val{:vspan}}, x, y, z)
|
||||||
n = div(length(y), 2)
|
n = div(length(x), 2)
|
||||||
newx = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
|
newx = vcat([[x[2i - 1], x[2i - 1], x[2i], x[2i], NaN] for i = 1:n]...)
|
||||||
newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n)
|
newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer=div(length(x),2))
|
||||||
linewidth --> 0
|
linewidth --> 0
|
||||||
x := newx
|
x := newx
|
||||||
y := newy
|
y := newy
|
||||||
|
|||||||
@ -199,9 +199,9 @@ julia> vline([-1,0,2])
|
|||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
@shorthands vline
|
@shorthands vline
|
||||||
vline(x; kw...) = plot(x, []; kw..., seriestype=:vline)
|
vline(x; kw...) = plot(x, repeat(Float64[1,2,NaN], length(x)); kw..., seriestype=:vline)
|
||||||
vline!(x; kw...) = plot!(x, []; kw..., seriestype=:vline)
|
vline!(x; kw...) = plot!(x, repeat(Float64[1,2,NaN], length(x)); kw..., seriestype=:vline)
|
||||||
vline!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:vline)
|
vline!(plt, x; kw...) = plot!(plt, x, repeat(Float64[1,2,NaN], length(x)); kw..., seriestype=:vline)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
hspan(y)
|
hspan(y)
|
||||||
@ -232,6 +232,9 @@ julia> vspan(1:6)
|
|||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
@shorthands vspan
|
@shorthands vspan
|
||||||
|
vspan(x; kw...) = plot(x, []; kw..., seriestype=:vspan)
|
||||||
|
vspan!(x; kw...) = plot!(x, []; kw..., seriestype=:vspan)
|
||||||
|
vspan!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:vspan)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
ohlc(x,y::Vector{OHLC})
|
ohlc(x,y::Vector{OHLC})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user