From 50f1106cd7badc04aaf1aa0be38228ad38db7c22 Mon Sep 17 00:00:00 2001 From: David MacMahon Date: Wed, 24 Mar 2021 20:47:14 -0700 Subject: [PATCH] Add recipe for `seriestype=:stepmid` --- src/recipes.jl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/recipes.jl b/src/recipes.jl index b188a33d..1ecbea62 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -229,6 +229,31 @@ make_steps(t::Tuple, st, even) = Tuple(make_steps(ti, st, even) for ti in t) end @deps steppre path scatter +# create a path from steps +@recipe function f(::Type{Val{:stepmid}}, x, y, z) + plotattributes[:x] = make_steps(x, :mid, true) + plotattributes[:y] = make_steps(y, :post, true) + seriestype := :path + + # handle fillrange + plotattributes[:fillrange] = make_steps(plotattributes[:fillrange], :post, true) + + # create a secondary series for the markers + if plotattributes[:markershape] != :none + @series begin + seriestype := :scatter + x := x + y := y + label := "" + primary := false + () + end + markershape := :none + end + () +end +@deps stepmid path scatter + # create a path from steps @recipe function f(::Type{Val{:steppost}}, x, y, z) plotattributes[:x] = make_steps(x, :pre, false)