Skip to content
Tutorials Center
My learning

Topics

Lesson 13 of 42 ยท Basic Charts

Funnel, Waterfall and Candlestick Charts

Draw business and finance charts in Plotly: funnel and funnel-area charts for conversion steps, waterfall charts for gains and losses, and candlestick and OHLC charts for prices.

Beyond bars, lines and pies, Plotly ships chart types built for specific business jobs. A funnel shows how many people survive each step of a process. A waterfall shows how a starting value turns into a final value through a series of increases and decreases. Candlestick and OHLC charts show the open, high, low and close of a price in each period.

This lesson shows all three families with the same approach: build the figure in Python, check the data it holds, and draw it with plotly.js.

Funnel charts

A funnel chart lists stages in order, with the largest at the top. It answers "where do we lose people?" Typical uses are sales pipelines, sign-up flows and checkout steps.

Python A conversion funnel

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The funnel stores the raw counts and plotly.js computes percentages. textinfo="value+percent previous+percent initial" prints for each stage the count, the share of the previous stage and the share of the first stage. These are exactly the numbers the loop above prints. Several traces (one per customer segment, or per month) can be drawn on the same funnel for comparison.

funnelarea is a pie-like variant (px.funnel_area(names=..., values=...)). The rectangular funnel is usually easier to read.

Waterfall charts

A waterfall chart explains change. Each bar floats, starting where the previous one ended. Increases and decreases get different colors, and "total" bars show running or final totals. Finance people use it for profit bridges: revenue minus costs equals profit.

Each bar has a measure:

Measure Meaning
relative A change added to the running total (positive or negative)
total A bar from zero to the running total
absolute Resets the running total to the given value
A profit waterfall and a candlestick chart

The waterfall's last bar uses measure: "total", which means "show the running total here": its own y value is ignored. The connector draws thin lines between bars so the eye follows the flow. Always label bars that are small relative to the scale, because tiny changes are easy to miss.

In Python, go.Waterfall(x=[...], y=[...], measure=[...]) takes the same arguments. Compute the final total yourself as a check:

Python Waterfall in Python, and check the arithmetic

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The final running total, 160, is the value plotly.js draws in the last bar, so waterfalls double-check your arithmetic.

Candlestick and OHLC charts

For each period (a minute, a day, a week), a price series has four numbers: open, high, low, close. A candlestick draws a body between open and close (filled one way when the price rose, another way when it fell) and thin "wicks" up to the high and down to the low. An OHLC chart draws the same data as a vertical bar with ticks to the left (open) and right (close). Both are specific to finance, but any data with start, end, minimum and maximum per period fits (daily temperature ranges, for example).

Python Build candlestick and OHLC figures

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Two things to remember: candlestick charts show a range slider by default, which you hide with xaxis_rangeslider_visible=False; and by default the x axis includes weekends as empty gaps when you use real dates. The axes lesson shows how to remove them with rangebreaks.

Reading these charts

  • Funnel: look for the biggest drop between two neighboring stages, since that is where improvements pay off most.
  • Waterfall: check that the starting bar plus all changes equals the total. Order the changes so the story is clear (big drivers first, or positives then negatives).
  • Candlestick: the color tells direction, the body size tells momentum, long wicks tell volatility.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What does measure="total" do in a waterfall trace?

    total shows the accumulated value so far. relative adds a change and absolute sets a new starting value.
  2. 2. Which four columns does a candlestick trace need?

    Each period needs its open, high, low and close prices, plus an x (date) value.
  3. 3. How do you hide the range slider that candlestick charts show by default?

    The slider belongs to the x axis, so it is turned off in the layout.
  4. 4. What does a funnel's textinfo="percent previous" show for each stage?

    percent previous is the conversion from the previous stage; percent initial compares with the first stage.
  5. 5. A waterfall's start is 500, then changes of -200, -180 and +40. What is the final total?

    500 - 200 - 180 + 40 = 160.

Summary

  • Funnels show step-by-step drop-off; px.funnel and go.Funnel compute percentages from counts.
  • Waterfalls explain a total through increases and decreases using measure values (absolute, relative, total).
  • Candlestick and OHLC charts show open, high, low and close per period; hide the range slider with xaxis_rangeslider_visible=False.
  • Verify the numbers in Python and label the key steps.

Next: Box, Violin and Strip Plots