Skip to main content

No project description provided

Project description

plotlywaterfall

Description

A small package adding simple waterfall plotting capabilities on top of the plotly graphing package. Waterfall graphs are useful to display e.g. financial data such ans cashflow statements in an easily digestible format.

While plotly includes basic capabilities to plot waterfall graphs, it ships only limited features. The plotlywaterfall package provides simple, plotly-express-style waterfall graphs with grouping, multiple stacked categories and variable colors.

Installation

Use pip3:

pip3 install plotlywaterfall

Usage

More examples can be found in the example notebook (https://github.com/docdru/plotlywaterfall/blob/main/example.ipynb). Let's use this dataframe for a simple yet complete example:

df = pd.DataFrame({
    "X": ["A", "B", "C"]*4 + ["D", "D" ], 
    "Y": [4, 1, 8, 7, 3, 2] + [i-1 for i in [4, 1, 8, 7, 3, 2]] + [8, 5],
    "category": ["one"]*3+["two"]*3 + ["one"]*3+["two"]*3 + ["two", "three"],
    "group": ["Group1"]*6 + ["Group2"]*6 + ["Group2", "Group3"]
})

DF

One can plot this data, with defined colors and automatic creating of total and subtotal, by using:

from plotlywaterfall.waterfall import Waterfall

colors = {
    "Group1": {"one": "red", "two": "blue"},
    "Group2": {"one": "salmon", "two": "lightskyblue"},
    "Group3": "green"
}


c = Waterfall(df, x="X", y="Y", category="category", colors=colors, group="group", total=True, subtotals={"C": "Subtotal"})
fig = c.get_fig()
fig

Resulting graph:

Example

Disclaimer

I might maintain and improve the package. I might also not.

Known open points:

  • It is not possible to have mixed signs per X-value.
  • I am note really happy with the interface for defining the colors.

Changelog

Refer to CHANGELOG.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotlywaterfall-0.9.2.tar.gz (66.8 kB view details)

Uploaded Source

Built Distribution

plotlywaterfall-0.9.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file plotlywaterfall-0.9.2.tar.gz.

File metadata

  • Download URL: plotlywaterfall-0.9.2.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.26.0

File hashes

Hashes for plotlywaterfall-0.9.2.tar.gz
Algorithm Hash digest
SHA256 960a20f6f29d880df8c0183b75acad2f97cb4b96cfd80db888d0953d879b0f0b
MD5 75e36f61424e6f627b6cbe7a4a02dd49
BLAKE2b-256 b319b468df67f712c2ec2461d5a66965c5aa254ea96c225fddcd1a9f17f2f430

See more details on using hashes here.

File details

Details for the file plotlywaterfall-0.9.2-py3-none-any.whl.

File metadata

File hashes

Hashes for plotlywaterfall-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7da280a9cbdc331f91a0710d086e8e41ededbc44bb0ec54394413fce3e3637c9
MD5 975f103cf6a55585d45e7e8c5d5ca1c4
BLAKE2b-256 db390380a3a73289d4203603a145a7929be789bbcd79b8e00357a2c92e55a767

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page