diff --git a/src/Plots.jl b/src/Plots.jl index 222270cb..f1026810 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -187,6 +187,8 @@ include("output.jl") @shorthands sticks @shorthands hline @shorthands vline +@shorthands hspan +@shorthands vspan @shorthands ohlc @shorthands contour @shorthands contourf diff --git a/src/recipes.jl b/src/recipes.jl index bfe7d0b4..099d9b38 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -100,6 +100,30 @@ end end @deps vline straightline +@recipe function f(::Type{Val{:hspan}}, x, y, z) + n = div(length(y), 2) + newx = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n) + newy = vcat([[y[2i-1], y[2i-1], y[2i], y[2i], NaN] for i in 1:n]...) + linewidth --> 0 + x := newx + y := newy + seriestype := :shape + () +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 in 1:n]...) + newy = repeat([-Inf, Inf, Inf, -Inf, NaN], outer = n) + linewidth --> 0 + x := newx + y := newy + seriestype := :shape + () +end +@deps vspan shape + # --------------------------------------------------------------------------- # path and scatter