Skip to content

Commit

Permalink
improve direction markers in waterfall recipe (#3361)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Schwabeneder <[email protected]>
Co-authored-by: Julius Krumbiegel <[email protected]>
  • Loading branch information
3 people authored Jan 2, 2024
1 parent 3f6f0f7 commit 506c6ca
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/basic_recipes/waterfall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,19 @@ function Makie.plot!(p::Waterfall)
xs = first(
compute_x_and_width(first.(fromto.xy), width, gap, dodge, n_dodge, dodge_gap)
)
xy = similar(fromto.xy)
shapes = fill(marker_pos, length(xs))
MarkerType = promote_type(typeof(marker_pos), typeof(marker_neg))
DataType = eltype(fromto.xy)
shapes = MarkerType[]
xy = DataType[]
for i in eachindex(xs)
y = last(fromto.xy[i])
fillto = fromto.fillto[i]
xy[i] = (xs[i], (y + fillto) / 2)
if fillto > y
shapes[i] = marker_neg
push!(xy, (xs[i], (y + fillto) / 2))
push!(shapes, marker_neg)
elseif fillto < y
push!(xy, (xs[i], (y + fillto) / 2))
push!(shapes, marker_pos)
end
end
return (xy=xy, shapes=shapes)
Expand Down

0 comments on commit 506c6ca

Please sign in to comment.