Skip to main content

A collection of Plotly figure templates with a Bootstrap theme

Project description

Dash Bootstrap Templates

dash-bootstrap-templates provides a collection of Plotly figure templates customized for Bootstrap themes. This library has a template for each of the 22 Bootstrap/Bootswatch themes available in the Dash Bootstrap Components Library.

Quickstart

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import dash_bootstrap_components as dbc

from dash_bootstrap_templates import load_figure_template

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
load_figure_template("bootstrap")


df = px.data.gapminder().query("continent != 'Asia'")  # remove Asia for visibility
fig = px.line(df, x="year", y="lifeExp", color="continent", line_group="country")


app.layout = dbc.Container(
    [
        html.H1("Dash Bootstrap Template Demo", className="bg-primary text-white p-2"),
        dbc.Row(dbc.Col(dcc.Graph(figure=fig))),
    ],
    fluid=True,
)

if __name__ == "__main__":
    app.run_server(debug=True)

image

Demo Apps

In the three demo apps below (code here), each graph on the left uses a Bootstrap figure template. The corresponding graph on the right uses the 'plotly' default figure template. Note that Bootstrap figure templates have colorways and fonts consistent with the app's Bootstrap theme.

Dash Bootstrap Template Compared To Plotly Default Template

Minty

image


Superhero

image



Cyborg

image

Background

Dash Labs is a new library that explores cutting edge technology and extends what’s possible to do with Dash. One innovative new feature creates figure templates based on Bootstrap themes. Some Dash Labs layout templates are Bootstrap-themed. Those can, at your option, generate figure templates at runtime.

dash-bootstrap-templates makes Dash Labs' figure templates available for any version of Dash. It uses Dash Labs' algorithms to generate the 22 most common Bootstrap figure templates and saves them in json format. load_figure_template() reads the json file, adds it to plotly.io and sets it as the default figure template for an app. See more information about Plotly figure templates here.

Available Themes

This library provis a figure template for the following Bootstrap/Bootswatch themes:

valid_themes = [ "bootstrap", "cerulean", "cosmo", "flatly", "journal", "litera", "lumen", "lux", "materia", "minty", "pulse", "sandstone", "simplex", "sketchy", "spacelab", "united", "yeti", "cyborg", "darkly", "slate", "solar", "superhero", ]

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

dash-bootstrap-templates-0.1.1.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

dash_bootstrap_templates-0.1.1-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file dash-bootstrap-templates-0.1.1.tar.gz.

File metadata

  • Download URL: dash-bootstrap-templates-0.1.1.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for dash-bootstrap-templates-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fb840c66604b16cfa1f871fa5c7bfee65b8ce1a898d9837fd1152094245257d2
MD5 06ede6babc6cac589bc2d4361e0bfdfc
BLAKE2b-256 f8983d1dc59f1d41121488ed6e5815036abfd936abdfd470ba50cef02e81e557

See more details on using hashes here.

File details

Details for the file dash_bootstrap_templates-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dash_bootstrap_templates-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for dash_bootstrap_templates-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5f39d6a00a4672863cf6ea47f5a322587d47c45c6e9c3515127e61b84e0a6d4
MD5 91a9d9777e80f3c5d651a306a535bb16
BLAKE2b-256 80468752ab9fde2d36ab5aaa9d181043598ebef9481d63a04f828e23e59aec7b

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