Plotly template SSB design
A Python library that provides a custom Plotly template for visualising data with consistent styling and layout. The font and colours follow the SSB Design-system https://design.ssb.no
This is not an official template. The template is still under development.
Features
- Custom Plotly layout that can be easily applied to any figure.
- Includes predefined color schemes, fonts, and other styling options.
- Compatible with Plotly go chart types, including bar, line, scatter, and Plotly tables.
Requirements
- Python 3.x
- Plotly 5.x or higher
Installation
You can install Plotly template SSB design via pip from PyPI:
pip install ssb-plotly-template
Usage
After installing the library, you can easily apply the custom Plotly template to your figures. Here’s how to use it:
- Import both Plotly and ssb-plotly-template
- Create a Plotly figure. with the ssb-plotly-template template.
Example
Import libraries and create data:
import ssb_plotly_template
import plotly.graph_objects as go
import pandas as pd
data = {
"Category": ["A", "B", "C", "D"],
"Values": [10, 23, 15, 7],
"Values2": [13, 22, 25, 17],
"Values3": [23, 23, 28, 27],
"Dates": ["2024-10-01", "2024-10-05", "2024-10-10", "2024-10-15"],
}
df = pd.DataFrame(data)
df["Dates"] = pd.to_datetime(df["Dates"])
Create Plotly Go bar chart with ssb-plotly-template.
bar_chart = go.Figure(
data=[go.Bar(x=df["Category"], y=df["Values"])],
layout_title_text="Bar Chart",
layout_template="ssb_plotly_template",
)
bar_chart.show()
Create timeline (scatter plot) with multiple lines with ssb-plotly-template.
timeline_chart = go.Figure(
data=[
go.Scatter(x=df["Dates"], y=df["Values"], mode="lines+markers", name="Line 1"),
go.Scatter(x=df["Dates"], y=df["Values2"], mode="lines+markers", name="Line 2"),
go.Scatter(x=df["Dates"], y=df["Values3"], mode="lines+markers", name="Line 2"),
],
layout_title_text="Timeline",
layout_template="ssb_plotly_template",
)
timeline_chart.show()
Create Plotly Table with ssb-plotly-template.
fig_table = go.Figure(
data=[
go.Table(
header=dict(values=list(df.columns)),
cells=dict(values=[df[col].tolist() for col in df.columns]),
)
]
)
fig_table.update_layout(template="ssb_plotly_template", title="Table")
fig_table.show()
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, Plotly template SSB design is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from Statistics Norway's SSB PyPI Template.
Metadata
Release files for ssb-plotly-template 0.0.1
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 | Actions |
|---|---|---|---|---|
| ssb_plotly_template-0.0.1.tar.gz | 5.5 kB | Without provenance | Details for ssb_plotly_template-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ssb_plotly_template-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for ssb_plotly_template-0.0.1-py3-none-any.whl |
Total release size: 11.2 kB
Release files / ssb_plotly_template-0.0.1.tar.gz
| Download URL | ssb_plotly_template-0.0.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8560a0091d00c10ae0732b26dbc636b0f4a1b3964fd83560487dcbfd99ffbbc7
|
|
BLAKE2b-256 checksum How to use checksums |
1c6267ac8e71120878a2cd215cb90fa1bdafa809e64a28f8689cce05dedfacd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / ssb_plotly_template-0.0.1-py3-none-any.whl
| Download URL | ssb_plotly_template-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22edf37c5ee1ae8979248c288ff1faf86ee98b692586b96f661b2a813d68da78
|
|
BLAKE2b-256 checksum How to use checksums |
6181452761aad6b45c780ca4760db7625cb0b51a24f6d916503a2faa5010caf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for ssb-plotly-template 0.0.1
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.