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.
Attributes
Available attributes and their defaults for Combined{Makie.waterfall}
are:
cycle [:color => :patchcolor]
direction_color :white
dodge MakieCore.Automatic()
dodge_gap 0.03
final_color RGBA{Float64}(0.8980392156862745,0.8980392156862745,0.8980392156862745,0.5)
final_dodge_gap 0
final_gap MakieCore.Automatic()
gap 0.2
marker_neg :dtriangle
marker_pos :utriangle
n_dodge MakieCore.Automatic()
show_direction false
show_final false
stack MakieCore.Automatic()
width MakieCore.Automatic()
Furthermore the same attributes as for barplot
are supported.
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)
These docs were autogenerated using Makie: v0.19.12, GLMakie: v0.8.12, CairoMakie: v0.10.12, WGLMakie: v0.8.16