Skip to main content

A collection of Plotly figure templates with a Bootstrap theme

Project description

Plotly Bootstrap Templates

[!NOTE] has been forked from https://github.com/AnnMarieW/dash-bootstrap-templates. All dependencies on dash and dash-bootstrap-components have been removed from the installable package to allow usage with plain plotly graphing library without the need to install dash. Package management has been modernized to uv and the package code has been cleaned up for the targeted purpose.

Figure Template Quickstart

[!TIP] Learn more about Plotly figure templates and themes at: https://plotly.com/python/templates/

Install the package as usual with your favorite Python package manager, the package name is plotly-bootstrap-templates. Then, use the main package function load_figure_template to load the template. It is automatically stored in the plotly.io.templates dictionary. plotly.io.templates.default will be automatically set to the requested template afterwards.

from plotly_bootstrap_templates import load_figure_template

load_figure_template("flatly")

You may load several theme at once by giving a list, the default template will then be the first in this list.

load_figure_template(["flatly", "solar"])

To get a full list of the available templates, print the TEMPLATES constant. For each of them, also a *_dark variant exists, which are listed in the TEMPLATES_DARK constant.

from plotly_bootstrap_templates import TEMPLATES, TEMPLATES_DARK

print("templates:\n", TEMPLATES)
print("dark templates:\n", TEMPLATES_DARK)

Development

To create the project virtual environment using uv run:

uv sync

To regenerate the template data files, run:

./_create_templates.py

The script is equipped with a respective shebang to tell uv which dependencies to use for that (which are not necessary at runtime of the package).

To run the test suite, use:

uv run pytest

This will generate an example plot of the gapminder test data set for every available theme and open the result in your default browser using the webbrowser package.

Further Information

For further reading visit the original repository.

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

plotly_bootstrap_templates-2.1.0.post1.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file plotly_bootstrap_templates-2.1.0.post1.tar.gz.

File metadata

File hashes

Hashes for plotly_bootstrap_templates-2.1.0.post1.tar.gz
Algorithm Hash digest
SHA256 ad987e5fe2c6ce55f96563b0ae976947b307b01cc9f324d64edaabb5cfc85074
MD5 823853669faa97799f2722010d935ecf
BLAKE2b-256 e74820c7ac700cce4e965b9d69351df1f86350021044f36d8a7b9482bff5e06b

See more details on using hashes here.

File details

Details for the file plotly_bootstrap_templates-2.1.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for plotly_bootstrap_templates-2.1.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 babfa4042e14d23b3797f6446d6b5eb25e55d5e2ca08b7dcabac6b6cef67d97a
MD5 3ac8fdbfee871b7d8c7ae88095ae998c
BLAKE2b-256 56e6cd12ea023498dc08b5ad79438c864e18f33b503dc8cfb895b0d453a21c58

See more details on using hashes here.

Supported by

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