Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A waterfall chart explains how a starting value becomes an ending value through a sequence of increases, decreases, subtotals, and totals. Plotly has a dedicated go.Waterfall trace, while Matplotlib requires you to calculate each bar’s baseline and draw it with Axes.bar(). This guide builds the same revenue bridge in both libraries, then covers labels, connectors, subtotals, validation, accessibility, and export choices.

What a waterfall chart shows

A waterfall chart is appropriate when the order and cumulative effect of changes matter. Common examples include revenue bridges, profit-and-loss analysis, budget versus actual variance, cash-flow movements, headcount changes, portfolio attribution, and conversion decomposition.

The basic relationship is:

ending value = starting value + all positive changes + all negative changes

It is usually the wrong choice for ranking unrelated categories or showing a trend over time. Use a sorted bar chart for ranking and a line chart for time series.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Example revenue bridge

Label Change Running total Bar bottom Bar height
Starting revenue 100 100 0 100
New sales +60 160 100 60
Consulting +80 240 160 80
Returns -40 200 200 40
Operating costs -20 180 180 20
Ending revenue Total 180 0 180

The unusual-looking negative rows are intentional: a decrease starts at the new, lower cumulative value and rises to the previous total.

Prepare waterfall data correctly

Keep three aligned fields: a label, a numeric value, and a measure type. Plotly recognizes three measure types:

  • relative adds or subtracts from the current running total.
  • absolute starts at a specified baseline or resets the running total.
  • total displays the current cumulative total without changing it.

For the example, the first row is absolute, the middle rows are relative, and the final row is total.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
labels = [
    "Starting revenue", "New sales", "Consulting",
    "Returns", "Operating costs", "Ending revenue"
]
values = [100, 60, 80, -40, -20, 0]
measures = ["absolute", "relative", "relative", "relative", "relative", "total"]

Using a pandas DataFrame

import pandas as pd

df = pd.DataFrame({
    "label": labels,
    "value": values,
    "measure": measures,
})

if not (len(df["label"]) == len(df["value"]) == len(df["measure"])):
    raise ValueError("All chart columns must have the same length")

allowed = {"absolute", "relative", "total"}
if not set(df["measure"]).issubset(allowed):
    raise ValueError("Invalid waterfall measure")

Do not silently turn missing values into zero. A missing value may mean zero, unavailable, not applicable, or suppressed data; choose that policy explicitly before plotting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create a waterfall chart with Matplotlib

Matplotlib’s standard API does not provide the same dedicated waterfall trace as Plotly. The normal approach is to calculate bar positions, draw rectangles with Axes.bar(bottom=...), and add connectors and labels separately. See the bar API, text API, and annotation API.

Reusable Matplotlib implementation

import matplotlib.pyplot as plt
import numpy as np

def waterfall_matplotlib(labels, values, measures=None, title=None):
    if measures is None:
        measures = ["absolute"] + ["relative"] * (len(values) - 1)
    if not (len(labels) == len(values) == len(measures)):
        raise ValueError("labels, values, and measures must have equal length")

    bottoms, heights, colors, shown = [], [], [], []
    running_total = 0

    for value, measure in zip(values, measures):
        if measure == "absolute":
            running_total = value
            bottoms.append(0)
            heights.append(value)
            colors.append("#4C78A8")
            shown.append(value)
        elif measure == "relative":
            previous_total = running_total
            running_total += value
            bottoms.append(previous_total if value >= 0 else running_total)
            heights.append(abs(value))
            colors.append("#2CA02C" if value >= 0 else "#D62728")
            shown.append(value)
        elif measure == "total":
            bottoms.append(0)
            heights.append(running_total)
            colors.append("#2F4B7C")
            shown.append(running_total)
        else:
            raise ValueError(f"Unknown measure: {measure}")

    x = np.arange(len(labels))
    fig, ax = plt.subplots(figsize=(10, 6))
    ax.bar(x, heights, bottom=bottoms, color=colors, edgecolor="black", width=0.7)

    for i in range(len(labels) - 1):
        top = bottoms[i] + heights[i]
        ax.plot([x[i] + 0.35, x[i + 1] - 0.35], [top, top],
                color="gray", linestyle="--", linewidth=1)

    for i, (bottom, height, value, measure) in enumerate(
        zip(bottoms, heights, shown, measures)
    ):
        if measure == "total":
            y, text = height, f"{value:,.0f}"
        elif measure == "absolute":
            y, text = bottom + height, f"{value:,.0f}"
        else:
            y = bottom + height if value >= 0 else bottom
            text = f"{value:+,.0f}"
        ax.text(x[i], y + 4, text, ha="center", va="bottom", fontsize=9)

    ax.set_xticks(x)
    ax.set_xticklabels(labels, rotation=25, ha="right")
    ax.set_ylabel("Value")
    ax.axhline(0, color="black", linewidth=0.8)
    ax.grid(axis="y", linestyle=":", alpha=0.5)
    ax.set_axisbelow(True)
    if title:
        ax.set_title(title)
    plt.tight_layout()
    return fig, ax

fig, ax = waterfall_matplotlib(
    labels, values, measures, title="Revenue Waterfall"
)
plt.show()

Why the baseline calculation matters

  • For a positive change, the bottom is the previous running total and the height is the change.
  • For a negative change, the bottom is the new running total and the height is the absolute value of the change.
  • For a total, the bottom is zero and the height is the running total.

Using a negative height with bottom=previous_total is a common error: it draws the bar downward from the old total instead of showing the interval between the old and new totals.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Create a waterfall chart with Plotly

Plotly’s go.Waterfall trace handles relative, absolute, and total semantics through the measure array. The official syntax and attributes are documented in the waterfall tutorial and trace reference.

import plotly.graph_objects as go

fig = go.Figure(go.Waterfall(
    name="Revenue",
    orientation="v",
    measure=measures,
    x=labels,
    y=values,
    text=["100", "+60", "+80", "-40", "-20", "180"],
    textposition="outside",
    connector={"line": {"color": "gray", "width": 1, "dash": "dot"}},
    increasing={"marker": {"color": "#2CA02C"}},
    decreasing={"marker": {"color": "#D62728"}},
    totals={"marker": {"color": "#2F4B7C"}},
))

fig.update_layout(
    title="Revenue Waterfall",
    yaxis_title="Value",
    showlegend=False,
    waterfallgap=0.35,
)
fig.show()

When using a DataFrame, pass df["label"], df["value"], and df["measure"] directly. Plotly still depends on correctly ordered data and correctly classified measures; it does not infer business meaning from labels.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Hover formatting and horizontal orientation

fig.update_traces(
    hovertemplate="<b>%{x}</b><br>Amount: $%{y:,.0f}<extra></extra>"
)

horizontal = go.Figure(go.Waterfall(
    orientation="h",
    measure=["absolute", "relative", "relative", "total"],
    y=["Opening balance", "Sales", "Costs", "Closing balance"],
    x=[100, 50, -30, 0],
    connector={"line": {"color": "gray"}},
))
horizontal.show()

With orientation="h", category labels are on the y-axis and numeric values are on the x-axis. textposition accepts inside, outside, auto, or none. Outside labels can be clipped on dense figures, so inspect the rendered result.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Subtotals and multiple traces

Use "total" for intermediate subtotals as well as the final result:

measure = [
    "absolute", "relative", "relative", "total",
    "relative", "relative", "total"
]

Plotly also supports multiple waterfall traces for years, regions, or scenarios. The official examples use grouped category labels and waterfallgroupgap to separate groups. Several traces can become dense; small multiples are often easier to read.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Matplotlib or Plotly?

Criterion Matplotlib Plotly
Waterfall primitive Compose bars, lines, and annotations Dedicated go.Waterfall trace
Interactivity Requires additional tooling Built in
Static publishing Excellent for PNG, SVG, and PDF workflows Possible with export tooling
Cumulative bookkeeping You calculate positions measure controls semantics
Styling Very granular High-level and declarative
Best fit Reports, papers, and print Notebooks, web pages, and dashboards

Choose Matplotlib when you need exact control over geometry and an established static publication style. Choose Plotly when readers need hover values, zooming, responsive sizing, or browser-based interaction. Plotly figures can be placed in a Dash Graph component for Python web applications; see Dash documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Plotly.py is free and open source according to its official site. Hosted Plotly services are separate products: pricing retrieved in August 2026 listed a free tier, Pro at $29 per Creator seat per month, and custom Enterprise pricing; verify current terms at Plotly pricing before purchase. Hosting is not required for local Plotly charts.

Production checks and troubleshooting

Validate the mathematics

  • Mark the opening observation as absolute.
  • Mark every true subtotal or ending balance as total, not relative.
  • Calculate labels from full-precision values and round only for display.
  • If a report uses rounded inputs, calculate the bridge from those same rounded inputs.
  • Check that units, currency, sign convention, and source period are visible in the title, axis, or caption.

Handle missing values explicitly

import pandas as pd

if pd.isna(value):
    raise ValueError(
        "Missing waterfall value; decide whether it means zero or unknown"
    )

Keep dense charts readable

  • Group immaterial movements into an “Other” category.
  • Use horizontal orientation when labels are long.
  • Show labels only for material changes and provide a companion table for detail.
  • Add y-axis headroom when labels sit outside bars.
  • Use a distinct neutral color for totals and visible connectors between steps.

Make colors accessible

Green for increases and red for decreases is familiar but should not be the only encoding. Consider blue for increases, orange or gray for decreases, and a darker neutral for totals. Keep explicit plus and minus signs, labels, or hatching so the meaning survives grayscale and color-vision differences.

Starting below zero and multiple resets

The same positive/negative logic works when the opening value is negative, but test label positions and y-axis margins around the zero line. Absolute bars and subtotal markers can reset or report the running state, so the final total is not automatically the sum of every raw value unless the bridge is one continuous sequence of relative changes.

Export and deployment options

Matplotlib can save static output directly:

fig.savefig("revenue_waterfall.png", dpi=200, bbox_inches="tight")
fig.savefig("revenue_waterfall.svg", bbox_inches="tight")
fig.savefig("revenue_waterfall.pdf", bbox_inches="tight")

Plotly can be shared as interactive HTML:

fig.write_html("revenue_waterfall.html", include_plotlyjs="cdn")

Static Plotly image export may require an additional renderer such as Kaleido, and package requirements can change. Check the current Plotly export documentation and your installed version before relying on a static-export workflow. The API pages retrieved for this guide represent Plotly 6.8.0 documentation, while the Matplotlib reference PDF represents 3.10.7; these are documentation versions, not universal minimum-version requirements.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When another chart is better

  • Sorted bar chart: compare many independent categories.
  • Stacked bar chart: show composition at several points.
  • Line chart: show a value changing over time.
  • Tornado chart: show sensitivity around a baseline.
  • Sankey diagram: show flows between entities rather than a single cumulative bridge.

The Bottom Line

Use Matplotlib for highly controlled static reports and Plotly for interactive notebooks, web pages, and dashboards. In either library, correct ordering, explicit absolute/relative/total semantics, and careful negative-bar placement are what make the waterfall mathematically trustworthy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.