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
|
||||
|
||||
@recipe function f(::Type{Val{:vline}}, x, y, z)
|
||||
n = length(x)
|
||||
newx = vec(Float64[xi for i = 1:3, xi in x])
|
||||
newy = repeat(Float64[1, 2, NaN], n)
|
||||
x := newx
|
||||
y := newy
|
||||
y := y
|
||||
seriestype := :straightline
|
||||
()
|
||||
end
|
||||
@ -145,9 +143,9 @@ end
|
||||
@deps hspan shape
|
||||
|
||||
@recipe function f(::Type{Val{:vspan}}, x, y, z)
|
||||
n = div(length(y), 2)
|
||||
newx = vcat([[y[2i - 1], y[2i - 1], y[2i], y[2i], NaN] for i = 1:n]...)
|
||||
newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n)
|
||||
n = div(length(x), 2)
|
||||
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=div(length(x),2))
|
||||
linewidth --> 0
|
||||
x := newx
|
||||
y := newy
|
||||
|
||||
@ -199,9 +199,9 @@ julia> vline([-1,0,2])
|
||||
```
|
||||
"""
|
||||
@shorthands vline
|
||||
vline(x; kw...) = plot(x, []; kw..., seriestype=:vline)
|
||||
vline!(x; kw...) = plot!(x, []; kw..., seriestype=:vline)
|
||||
vline!(plt, x; kw...) = plot!(plt, x, []; kw..., seriestype=:vline)
|
||||
vline(x; kw...) = plot(x, repeat(Float64[1,2,NaN], length(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, repeat(Float64[1,2,NaN], length(x)); kw..., seriestype=:vline)
|
||||
|
||||
"""
|
||||
hspan(y)
|
||||
@ -232,6 +232,9 @@ julia> vspan(1:6)
|
||||
```
|
||||
"""
|
||||
@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})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user