Lightning-fast way to get plots with Plotly


Keywords
python, data, science, analytics, plotly, plotting, data-analysis, data-science, plotting-in-python, visualization
License
MIT
Install
pip install blitzly==0.5.0

Documentation

blitzly logo

blitzly โšก๏ธ

Lightning-fast way to get plots with Plotly

DeployPackage Testing codecov Open In Colab 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 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 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.

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 ๐Ÿ“’.

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.