waterfall

waterfall(x, y; kwargs...)

Plots a waterfall chart to visualize individual positive and negative components that add up to a net result as a barplot with stacked bars next to each other.

Plot type

The plot type alias for the waterfall function is Waterfall.

Attributes

color = @inherit patchcolorNo docs available.

cycle = [:color => :patchcolor]No docs available.

direction_color = @inherit backgroundcolorNo docs available.

dodge = automaticNo docs available.

dodge_gap = 0.03No docs available.

final_color = plot_color(:grey90, 0.5)No docs available.

final_dodge_gap = 0No docs available.

final_gap = automaticNo docs available.

gap = 0.2No docs available.

marker_neg = :dtriangleNo docs available.

marker_pos = :utriangleNo docs available.

n_dodge = automaticNo docs available.

show_direction = falseNo docs available.

show_final = falseNo docs available.

stack = automaticNo docs available.

width = automaticNo docs available.

Examples

using CairoMakie

y = [6, 4, 2, -8, 3, 5, 1, -2, -3, 7]

waterfall(y)

The direction of the bars might be easier to parse with some visual support.

using CairoMakie

y = [6, 4, 2, -8, 3, 5, 1, -2, -3, 7]

waterfall(y, show_direction=true)

You can customize the markers that indicate the bar directions.

using CairoMakie

y = [6, 4, 2, -8, 3, 5, 1, -2, -3, 7]

waterfall(y, show_direction=true, marker_pos=:cross, marker_neg=:hline, direction_color=:gold)

If the dodge attribute is provided, bars are stacked by dodge.

using CairoMakie
colors = Makie.wong_colors()

x = repeat(1:2, inner=5)
y = [6, 4, 2, -8, 3, 5, 1, -2, -3, 7]
group = repeat(1:5, outer=2)

waterfall(x, y, dodge=group, color=colors[group])

It can be easier to compare final results of different groups if they are shown in the background.

using CairoMakie
colors = Makie.wong_colors()

x = repeat(1:2, inner=5)
y = [6, 4, 2, -8, 3, 5, 1, -2, -3, 7]
group = repeat(1:5, outer=2)

waterfall(x, y, dodge=group, color=colors[group], show_direction=true, show_final=true)

The color of the final bars in the background can be modified.

using CairoMakie
colors = Makie.wong_colors()

x = repeat(1:2, inner=5)
y = [6, 4, 2, -8, 3, 5, 1, -2, -3, 7]
group = repeat(1:5, outer=2)

waterfall(x, y, dodge=group, color=colors[group], show_final=true, final_color=(colors[6], 1//3))

You can also specify to stack grouped waterfall plots by x.

using CairoMakie
colors = Makie.wong_colors()

x = repeat(1:5, outer=2)
y = [6, 4, 2, -8, 3, 5, 1, -2, -3, 7]
group = repeat(1:2, inner=5)

waterfall(x, y, dodge=group, color=colors[group], show_direction=true, stack=:x)