Note
Go to the end to download the full example code.
Basic Waterfall Chart#
Generate a waterfall chart using the waterfall_chart function.
Waterfall charts can show the net result of a starting value after a series of positive/negative adjustments.
seriesmust be used to specify data points that are the starting endingtotals, incrementaladditions, and incrementalsubtractionsThe
y1_axiscan be used to customize y-axis behaviordatamust be a single row with each column representing a total, addition, or subtractiontotalmust be two series each representing the starting value and ending value respectively
import pandas as pd
from visualization_toolkit.helpers.plotly import waterfall_chart, axis, series
fig = waterfall_chart(
pdf,
y1_axis=axis(label="Spend", axis_type="currency"),
totals=[
series(
column_name="prior_period",
label="Prior Period",
),
series(
column_name="ending_period",
label="Ending Period",
),
],
additions=[
series(
column_name="expansion",
label="Expansion",
),
],
subtractions=[
series(
column_name="contraction",
label="Contraction",
),
series(
column_name="churn",
label="Churn",
),
],
)
fig
Total running time of the script: (0 minutes 0.016 seconds)