{ "cells": [ { "cell_type": "markdown", "id": "f8c32ab5", "metadata": {}, "source": [ "Let's dig into waterfall plots in plotly, and see how much we can customize this" ] }, { "cell_type": "code", "execution_count": 1, "id": "be8f4a63", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import plotly.graph_objects as go\n", "\n", "import plotly.io as pio\n", "pio.renderers.default = \"notebook_connected\"" ] }, { "cell_type": "markdown", "id": "9763c551", "metadata": {}, "source": [ "Start with the base example from the documentation:" ] }, { "cell_type": "code", "execution_count": 2, "id": "65a1a053", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " | measure | \n", "x | \n", "y | \n", "text | \n", "
---|---|---|---|---|
0 | \n", "absolute | \n", "2020 OM | \n", "80 | \n", "$80M | \n", "
1 | \n", "relative | \n", "Revenue | \n", "10 | \n", "▲$10M | \n", "
2 | \n", "relative | \n", "Cost of Sales | \n", "-5 | \n", "▼$5M | \n", "
3 | \n", "relative | \n", "Spending | \n", "-20 | \n", "▼$20M | \n", "
4 | \n", "total | \n", "2021 OM | \n", "100 | \n", "$65M | \n", "