.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "recipes/waterfall_chart/plot_waterfall_chart.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_recipes_waterfall_chart_plot_waterfall_chart.py: 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. - ``series`` must be used to specify data points that are the starting ending ``totals``, incremental ``additions``, and incremental ``subtractions`` - The ``y1_axis`` can be used to customize y-axis behavior - ``data`` must be a single row with each column representing a total, addition, or subtraction - ``total`` must be two series each representing the starting value and ending value respectively .. GENERATED FROM PYTHON SOURCE LINES 14-51 .. raw:: html


.. code-block:: Python 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 .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.016 seconds) .. _sphx_glr_download_recipes_waterfall_chart_plot_waterfall_chart.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_waterfall_chart.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_waterfall_chart.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_waterfall_chart.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_