Skip to main content

Lightning-fast way to get plots with Plotly

Project description

blitzly logo

blitzly ⚡️

Lightning-fast way to get plots with Plotly

DeployPackage Testing codecov pypi PyPI - Downloads python version docs pre-commit license isort black mypy linting: pylint

Introduction 🎉

Plotly is great and powerful. But with great power comes great responsibility 🕸. And sometimes you just want to get a plot up and running as fast as possible. That's where blitzly ⚡️ comes in. It provides a set of functions that allow you to create plots with Plotly in a lightning-fast way. It's not meant to replace Plotly, but rather to complement it.

Check out some examples in the Jupyter notebook.
Open In Colab

Install the package 📦

If you are using pip, you can install the package with the following command:

pip install blitzly

If you are using Poetry, you can install the package with the following command:

poetry add blitzly

installing dependencies 🧑‍🔧

With pip:

pip install -r requirements.txt

With Poetry:

poetry install

Available plots (so far 🚀)

Module Method Description
bar model_feature_importances Creates a bar chart with the feature importance of a model.
bar multi_chart Creates a bar chart with multiple groups.
dumbbell simple_dumbbell Plots a dumbbell plot. This can be used to compare two columns of data to visualize changes.
histogram simple_histogram Plots a histogram with one ore more distributions.
matrix binary_confusion_matrix Plots a confusion matrix for binary classification data.
matrix cramers_v_corr_matrix Cramer's V correlation for categorical features.
matrix pearson_corr_matrix Plots a Pearson product-moment correlation coefficients matrix.
scatter scatter_matrix Plots a scatter matrix.
scatter multi_scatter Create a multi scatter plot. It can be used to visualize the relationship between multiple variables from the same Pandas DataFrame.
scatter dimensionality_reduction Creates a plot to visualize higher dimensionality reduced data using matrix decomposition

Subplots 👩‍👩‍👧‍👦

Module Method Description
subplots make_subplots Create subplots using figure objects created with any of the above available plots.

Usage 🤌

Here are some examples. You can also open the playground notebook 📒.

dimensionality_reduction:

from blitzly.plots.scatter import dimensionality_reduction
import plotly.express as px

df = px.data.iris()
dimensionality_reduction(
  df,
  n_components=2,
  target_column="species",
  reduction_funcs=["PCA", "TNSE"],
)

Gives you this: dimensionality reduction plot

multi_bar:

from blitzly.plots.bar import multi_bar
import numpy as np

data = np.array([[8, 3, 6], [9, 7, 5]])
error_array = np.array([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]])

multi_bar(
    data,
    x_labels=["Vienna", "Berlin", "Lisbon"],
    group_labels=["Personal rating", "Global rating"],
    errors=error_array,
    title="City ratings 🏙",
    mark_x_labels=["Lisbon"],
    write_html_path="see_the_blitz.html",
)

Gives you this: multi bars plot

scatter matrix:

    from blitzly.plots.scatter import scatter_matrix
    import numpy as np
    import pandas as pd

    foo = np.random.randn(1000)
    bar = np.random.randn(1000) + 1
    blitz = np.random.randint(2, size=1000)
    licht = np.random.randint(2, size=1000)
    data = np.array([foo, bar, blitz, licht])
    df = pd.DataFrame(data.T, columns=["foo", "bar", "blitz", "licht"])

    scatter_matrix(
        df,
        dimensions=["foo", "bar", "blitz"],
        color_dim=df["licht"],
        title="My first scatter matrix 🙃",
        show_upper_half=True,
        diagonal_visible=False,
        marker_color_scale="Rainbow",
        marker_line_color="blue",
        size=(500, 500),
    )

Gives you this: scatter-matrix plot

Contributing 👩‍💻

Please check out the guide on how to contribute to this project.

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

blitzly-0.6.2.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

blitzly-0.6.2-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file blitzly-0.6.2.tar.gz.

File metadata

  • Download URL: blitzly-0.6.2.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.15.0-1031-azure

File hashes

Hashes for blitzly-0.6.2.tar.gz
Algorithm Hash digest
SHA256 ba1fba1c8f26743bfc6187a9f57cb9ca272a995e7a1f8581623b3ac270222883
MD5 2a0a630a52eb6d578eddc8fe87a19188
BLAKE2b-256 de48cbf026966ffa3c2e3601613a1e09bee424aa0185535192b4c899b3dff231

See more details on using hashes here.

File details

Details for the file blitzly-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: blitzly-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Linux/5.15.0-1031-azure

File hashes

Hashes for blitzly-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e76f0d77260b80b0d74a486d7846cb3b1d9b81a09e3585c6e3370bda1053089a
MD5 4d75fd4d96af1616aaab145e501836a5
BLAKE2b-256 9e6826e42e0f9284da8823c4ec56e300e51e673fc6163458bc3689d2880c8fec

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