Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fvinas/businessplots

A Python / Matplotlib toolkit to quickly draw business & consulting-style quality plots.
https://github.com/fvinas/businessplots

arrows bar business cagr consulting dataviz matplotlib

Last synced: about 1 month ago
JSON representation

A Python / Matplotlib toolkit to quickly draw business & consulting-style quality plots.

Awesome Lists containing this project

README

        

# businessplots

A Python / Matplotlib toolkit to quickly draw business & consulting-style quality plots.

Still in early stage! But feel free to test & discuss.

## Gallery

![Combination of CAGR and difference arrows](https://github.com/fvinas/businessplots/blob/master/doc/example.png)

![Difference arrows of several bars](https://github.com/fvinas/businessplots/blob/master/doc/example2.png)

## Usage example:

```python
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

from businessplots import arrows
from businessplots import formatters
from businessplots import axis
from businessplots import title

y = [2744000, 3028000, 3257000, 3642000, 3932000, 4314000, 4604000, 5061000, 5464000, 5933000, 6312000, 6879000]
x = [i for i, _ in enumerate(y)]
plt.rcParams['figure.figsize'] = (16.0, 10.0)

fig = plt.figure()

# No arrow
ax1 = fig.add_subplot(221)
ax1.bar(x, y, label="y")
ax1.set_title("No arrow")

# CAGR-like arrow
ax2 = fig.add_subplot(222)
ax2.bar(x, y, label="y")
arrows.increase_arrow()
ax2.set_title("CAGR-like arrow")

# Difference arrow
ax3 = fig.add_subplot(223)
ax3.bar(x, y, label="y")
arrows.increase_arrow(arrow_kind='delta', format_func=formatters.delta_simplified())
axis.yaxis_to_simplified()
ax3.set_title("Difference arrow, unit")

# Other stuff
ax4 = fig.add_subplot(224)
ax4.bar(x, y, label="y")
arrows.increase_arrow(index_from=0, index_to=3, arrow_kind='delta')
arrows.increase_arrow(index_from=4, index_to=7, arrow_kind='delta')
arrows.increase_arrow(index_from=8, index_to=11, arrow_kind='delta')
axis.yaxis_to_simplified()
title.pretty_title(ax4, 'Pretty title', 'Turnover in the last 4 years')

plt.tight_layout()
plt.show()
```

![Usage example](https://github.com/fvinas/businessplots/blob/master/doc/example3.png)

## TODO
- enhance API so that all options can be customized (color, etc.)
- set a config dict + defaults to easily plot
- add businessplots.source to quickly add a source below the chart
- same for ylim, xlim ==> provide a method to auto compute them (==> use ax.margins?)
- new types of arrows
- change default font to a beautiful one (if exists)
- waterfall
- add support for stacked bars
- ability to set units once at all