chartify-helpers
Some lightweight helper functions which add readability/functionality to Spotify's chartify library
Installation:
via pip:
pip install chartify-helpers
via github:
git clone https://github.com/KristofPusztai/chartify-helpers.git
navigate to cloned directory and run setup.py
sudo python setup.py install
Usage:
Custom Callouts:
Method:
custom_callouts(chart, custom_callout, xs, ys,
labels, colors, legend=True, label_text=False,
sizes=None, alphas=None, text_offset=0.0005)
from chartify_helpers import custom_callouts
# Generate example data
data = chartify.examples.example_data()
# Sum price grouped by date
price_by_date = (
data.groupby('date')['total_price'].sum()
.reset_index() # Move 'date' from index to column
)
# Plot the data
ch = chartify.Chart(blank_labels=True, x_axis_type='datetime')
ch.set_title("Line charts")
ch.set_subtitle("Custom Callouts")
ch.plot.line(
# Data must be sorted by x column
data_frame=price_by_date.sort_values('date'),
x_column='date',
y_column='total_price')
# Diamond Callout
custom_callouts(ch, ch.figure.diamond,
[[price_by_date['date'][54]]], [[price_by_date['total_price'][54]]],
['diamond callout'], ['orange'],
legend=True, label_text=True, sizes=[10],alphas=[1], text_offset=0.3)
# Circular Callout
custom_callouts(ch, ch.figure.circle,
[[price_by_date['date'][103]]], [[price_by_date['total_price'][103]]],
['circular callout'], ['green'],
legend=True, label_text=True, sizes=[10],alphas=[1], text_offset=0.3)
# Square Callout
custom_callouts(ch, ch.figure.square,
[[price_by_date['date'][146]]], [[price_by_date['total_price'][146]]],
['square callout'], ['red'],
legend=True, label_text=True, sizes=[10],alphas=[1], text_offset=0.3)
More callout styles found here
Stacked Bar Chart Top Labels:
Method:
add_stacked_label(chart, categories, labels, y , colors=None, sizes='10pt')
from chartify_helpers import add_stacked_label
# Generate example data
data = chartify.examples.example_data()
quantity_by_fruit_and_country = (data.groupby(
['fruit', 'country'])['quantity'].sum().reset_index())
# Plot the data
ch = chartify.Chart(blank_labels=True,
x_axis_type='categorical')
ch.set_title("Stacked bar chart")
ch.set_subtitle("Stack columns by a categorical factor, with top labels")
ch.plot.bar_stacked(
data_frame=quantity_by_fruit_and_country,
categorical_columns=['fruit'],
numeric_column='quantity',
stack_column='country',
normalize=False)
ch.set_legend_location('top_right')
# Adding numerical labels above each bar
add_stacked_label(ch,data.groupby('fruit').sum()['quantity'].index,
data.groupby('fruit').sum()['quantity'].values,
data.groupby('fruit').sum()['quantity'].values)
ch.show('png')
Metadata
Release files for chartify-helpers 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| chartify_helpers-1.2.2.tar.gz | 12.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chartify_helpers-1.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.7 kB
Release files / chartify_helpers-1.2.2.tar.gz
| Download URL | chartify_helpers-1.2.2.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9aea12874cc9cf56d1e20de1189ca440419930356927c8ee71f14abf6f7d827
|
|
BLAKE2b-256 checksum How to use checksums |
00712174c290e9c73dcca300e898d6077321b3e7ee4ed9b1316f09e497c3aa06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / chartify_helpers-1.2.2-py3-none-any.whl
| Download URL | chartify_helpers-1.2.2-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84c5259edf16bf2f0e351034a9efc9db18d019d737f03159f28feb3bda34bd46
|
|
BLAKE2b-256 checksum How to use checksums |
ae85b1f1f0e3b9c2a62b9b9899feabb923b518462888893bb24423c017767f01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for chartify-helpers 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.