# bbcstyle
[](https://pypi.org/project/bbcstyle/)


bbcstyle is a lightweight Python package that applies a BBC News-inspired visual theme to Matplotlib and Seaborn plots. It helps you create clean, publication-ready charts with consistent typography, minimalist gridlines, and optional source annotations or logos. Inspired by the R package [`bbplot`](https://github.com/bbc/bbplot) but tailored for Python, this theme is ideal for reports, dashboards, and data journalism.
<p align="center">
<img src="https://raw.githubusercontent.com/ale-tom/bbcstyle/main/assets/front_page.png"
alt="Plots styled with bbcstyle" width="800">
</p>
## Quick start
### 1. Install the package
```bash
pip install bbcstyle
```
### 2. Enable the theme
Call the theme hook **once** at the start of your script/notebook:
```python
import bbcstyle as bbc
bbc.set_theme()
```
### 3. Finish figures with the finaliser
After you build your Matplotlib figure, call `finalise_pot` to add the BBC-style framing (title, subtitle, divider abot the source, and optional logo) and to save it if you provide a path.
### Example A - line chart:
```python
import matplotlib.pyplot as plt
import numpy as np
import bbcstyle as bbc
from bbcstyle import finalise_plot
bbc.set_theme()
x = np.arange(0, 24)
fig, ax = plt.subplots(figsize=(9, 5), dpi=150)
ax.plot(x, np.cumsum(np.random.normal(0, 0.8, size=x.size)), linewidth=2, label="North")
ax.plot(x, np.cumsum(np.random.normal(0, 0.8, size=x.size)), linewidth=2, label="South")
ax.plot(x, np.cumsum(np.random.normal(0, 0.8, size=x.size)), linewidth=2, label="East")
ax.plot(x, np.cumsum(np.random.normal(0, 0.8, size=x.size)), linewidth=2, label="West")
ax.legend(frameon=False, ncols=2)
ax.spines[["top", "right"]].set_visible(False)
ax.set_xlabel("Hour")
ax.set_ylabel("Index")
finalise_plot(
fig=fig,
title="Regional index over the day",
subtitle="Synthetic data, 24 hours",
source="Source: Example data",
logo_path=None, # e.g. "assets/bbc_logo.png"
output_path="out/line_chart.png", # omit to skip saving
dpi=300,
)
```
### Example B - bar chart using theme colors
The theme defines the color cycle in axes.prop_cycle. Use it directly so bars follow the theme palette.
```python
import matplotlib.pyplot as plt
import bbcstyle as bbc
from bbcstyle import finalise_plot
bbc.set_theme()
cats = ["A", "B", "C", "D", "E"]
vals = [5, 7, 3, 6, 4]
# Pull colors from the active theme cycle
colors = plt.rcParams["axes.prop_cycle"].by_key()["color"]
fig, ax = plt.subplots(figsize=(8, 5), dpi=150)
ax.bar(cats, vals, color=colors[: len(cats)])
ax.spines[["top", "right"]].set_visible(False)
ax.set_xlabel("Category")
ax.set_ylabel("Value")
finalise_plot(
fig=fig,
title="Example: Bar Chart",
subtitle="Five categories coloured by the theme",
source="Source: Example data",
logo_path=None,
output_path="out/bar_chart.png",
dpi=300,
)
```
### Notes
- Call `bbc.set_theme()` **before** creating figures so rcParams apply to everything you draw.
- finalise_plot:
* Keeps your figure size unless you pass `enforce_size=True`.
* Places a divider a fixed distance (in points) **above** the source line.
* If `logo_path` and `source` are provided, the logo is anchored **bottom-right**, aligned to the source baseline.
- Avoid `plt.tight_layout()` after `finalise_plot`; the finaliser manages margins for title/subtitle/source.
## Gallery
`examples/gallery/01_bar_chart.py`
<p align="center">
<img src="https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/bar_chart.png"
alt="Bar chart styled with bbcstyle" width="600">
</p>
<br><br>
`examples/gallery/02_line_chart.py`
<p align="center">
<img src="https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/line_chart.png"
alt="Line plot styled with bbcstyle" width="600">
</p>
<br><br>
`examples/gallery/03_scatter_plot.py`
<p align="center">
<img src="https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/scatter.png"
alt="Scatter plot styled with bbcstyle" width="600">
</p>
`examples/gallery/04_histograms.py`
<p align="center">
<img src="https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/histograms.png"
alt="Blue wave histogram styled with bbcstyle" width="600">
</p>
<br><br>
`examples/gallery/05_bubble_scatter.py`
<p align="center">
<img src="https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/bubble_scatter.png"
alt="Bubble scatter plot styled with bbcstyle" width="600">
</p><br><br>
Run them to generate PNGs in `examples/gallery/out/`.
## License
This project is licensed under the MIT License. See [LICENSE](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/LICENSE) for details.
> **Note:** “BBC” is a trademark of the British Broadcasting Corporation. This project is not affiliated with, endorsed by, or sponsored by the BBC. “BBC-inspired” refers to the general look & feel of certain public graphics.
## Issues & support
Found a bug or have a feature request? Please open an issue and include:
- a **minimal code snippet** that reproduces the problem
- your **Python**, **Matplotlib**, and **Seaborn** versions, plus OS
- what you **expected** vs what you **observed**, and any screenshots
See [bug report](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/.github/ISSUE_TEMPLATE/bug_report.md) and [feature request](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/.github/ISSUE_TEMPLATE/feature_request.md) for details.
## Contributing
Contributions are welcome! A good first PR is often:
- a small fix to styling defaults,
- an additional **gallery** example in `examples/gallery/`,
- or a doc improvement.
See [contributing](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/docs/CONTRIBUTING.md) for details.
### Quick dev setup:
```bash
python -m venv .venv && source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .
python -m pip install -U pytest ruff pre-commit
pre-commit install
pytest -q
```
### Guidelines
Open an issue before large changes.
Keep examples pure-Python (no notebooks) and save images to examples/gallery/out/.
Run ruff and the pre-commit hooks; keep PRs focused and small.
Add or update a test when changing behavior.
See [contributing](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/docs/CONTRIBUTING.md) for details.
## Code of Conduct
We follow the [Contributor Covenant](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/docs/CODE_OF_CONDUCT.md). By participating, you agree to uphold this standard.
## Authorship & credits
Created and maintained by Alessandro Tomassini (@ale-tom).
Thanks to contributors and the broader visualization community for inspiration. Any similarities to BBC graphics are purely stylistic; this project is independent of the BBC.
## Citation
If this package helps your work, please cite it:
```bibtex
@software{bbcstyle,
title = {bbcstyle: BBC-inspired theme for Matplotlib/Seaborn},
author = {Alessandro Tomassini},
year = {2025},
version = {0.1.0},
url = {https://github.com/ale-tom/bbcstyle}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "bbcstyle",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "matplotlib, seaborn, theme, visualization, bbc",
"author": "Alessandro Tomassini",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/52/f5/395912ca47f58197265701e02d790bd1b34701ac54fa50d446657ca18973/bbcstyle-0.1.1.tar.gz",
"platform": null,
"description": "# bbcstyle\n[](https://pypi.org/project/bbcstyle/)\n\n\n\nbbcstyle is a lightweight Python package that applies a BBC News-inspired visual theme to Matplotlib and Seaborn plots. It helps you create clean, publication-ready charts with consistent typography, minimalist gridlines, and optional source annotations or logos. Inspired by the R package [`bbplot`](https://github.com/bbc/bbplot) but tailored for Python, this theme is ideal for reports, dashboards, and data journalism.\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ale-tom/bbcstyle/main/assets/front_page.png\"\n alt=\"Plots styled with bbcstyle\" width=\"800\">\n</p>\n\n## Quick start\n\n### 1. Install the package\n```bash\n pip install bbcstyle\n```\n### 2. Enable the theme\nCall the theme hook **once** at the start of your script/notebook:\n```python\nimport bbcstyle as bbc\n\nbbc.set_theme()\n```\n### 3. Finish figures with the finaliser\nAfter you build your Matplotlib figure, call `finalise_pot` to add the BBC-style framing (title, subtitle, divider abot the source, and optional logo) and to save it if you provide a path.\n\n### Example A - line chart:\n```python\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport bbcstyle as bbc\nfrom bbcstyle import finalise_plot\n\nbbc.set_theme()\n\nx = np.arange(0, 24)\nfig, ax = plt.subplots(figsize=(9, 5), dpi=150)\n\nax.plot(x, np.cumsum(np.random.normal(0, 0.8, size=x.size)), linewidth=2, label=\"North\")\nax.plot(x, np.cumsum(np.random.normal(0, 0.8, size=x.size)), linewidth=2, label=\"South\")\nax.plot(x, np.cumsum(np.random.normal(0, 0.8, size=x.size)), linewidth=2, label=\"East\")\nax.plot(x, np.cumsum(np.random.normal(0, 0.8, size=x.size)), linewidth=2, label=\"West\")\n\nax.legend(frameon=False, ncols=2)\nax.spines[[\"top\", \"right\"]].set_visible(False)\nax.set_xlabel(\"Hour\")\nax.set_ylabel(\"Index\")\n\nfinalise_plot(\n fig=fig,\n title=\"Regional index over the day\",\n subtitle=\"Synthetic data, 24 hours\",\n source=\"Source: Example data\",\n logo_path=None, # e.g. \"assets/bbc_logo.png\"\n output_path=\"out/line_chart.png\", # omit to skip saving\n dpi=300,\n)\n```\n### Example B - bar chart using theme colors\nThe theme defines the color cycle in axes.prop_cycle. Use it directly so bars follow the theme palette.\n\n```python\nimport matplotlib.pyplot as plt\nimport bbcstyle as bbc\nfrom bbcstyle import finalise_plot\n\nbbc.set_theme()\n\ncats = [\"A\", \"B\", \"C\", \"D\", \"E\"]\nvals = [5, 7, 3, 6, 4]\n\n# Pull colors from the active theme cycle\ncolors = plt.rcParams[\"axes.prop_cycle\"].by_key()[\"color\"]\n\nfig, ax = plt.subplots(figsize=(8, 5), dpi=150)\nax.bar(cats, vals, color=colors[: len(cats)])\n\nax.spines[[\"top\", \"right\"]].set_visible(False)\nax.set_xlabel(\"Category\")\nax.set_ylabel(\"Value\")\n\nfinalise_plot(\n fig=fig,\n title=\"Example: Bar Chart\",\n subtitle=\"Five categories coloured by the theme\",\n source=\"Source: Example data\",\n logo_path=None,\n output_path=\"out/bar_chart.png\",\n dpi=300,\n)\n```\n### Notes\n- Call `bbc.set_theme()` **before** creating figures so rcParams apply to everything you draw.\n- finalise_plot:\n * Keeps your figure size unless you pass `enforce_size=True`.\n * Places a divider a fixed distance (in points) **above** the source line.\n * If `logo_path` and `source` are provided, the logo is anchored **bottom-right**, aligned to the source baseline.\n\n- Avoid `plt.tight_layout()` after `finalise_plot`; the finaliser manages margins for title/subtitle/source.\n\n## Gallery\n`examples/gallery/01_bar_chart.py`\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/bar_chart.png\"\n alt=\"Bar chart styled with bbcstyle\" width=\"600\">\n</p>\n\n<br><br>\n\n`examples/gallery/02_line_chart.py`\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/line_chart.png\"\n alt=\"Line plot styled with bbcstyle\" width=\"600\">\n</p>\n<br><br>\n\n`examples/gallery/03_scatter_plot.py`\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/scatter.png\"\n alt=\"Scatter plot styled with bbcstyle\" width=\"600\">\n</p>\n\n`examples/gallery/04_histograms.py`\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/histograms.png\"\n alt=\"Blue wave histogram styled with bbcstyle\" width=\"600\">\n</p>\n<br><br>\n\n`examples/gallery/05_bubble_scatter.py`\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ale-tom/bbcstyle/main/examples/gallery/out/bubble_scatter.png\"\n alt=\"Bubble scatter plot styled with bbcstyle\" width=\"600\">\n</p><br><br>\n\nRun them to generate PNGs in `examples/gallery/out/`.\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/LICENSE) for details.\n\n> **Note:** \u201cBBC\u201d is a trademark of the British Broadcasting Corporation. This project is not affiliated with, endorsed by, or sponsored by the BBC. \u201cBBC-inspired\u201d refers to the general look & feel of certain public graphics.\n\n## Issues & support\n\nFound a bug or have a feature request? Please open an issue and include:\n- a **minimal code snippet** that reproduces the problem\n- your **Python**, **Matplotlib**, and **Seaborn** versions, plus OS\n- what you **expected** vs what you **observed**, and any screenshots\n\nSee [bug report](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/.github/ISSUE_TEMPLATE/bug_report.md) and [feature request](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/.github/ISSUE_TEMPLATE/feature_request.md) for details.\n\n## Contributing\n\nContributions are welcome! A good first PR is often:\n- a small fix to styling defaults,\n- an additional **gallery** example in `examples/gallery/`,\n- or a doc improvement.\n\nSee [contributing](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/docs/CONTRIBUTING.md) for details.\n\n### Quick dev setup:\n\n```bash\npython -m venv .venv && source .venv/bin/activate\npython -m pip install -U pip\npython -m pip install -e .\npython -m pip install -U pytest ruff pre-commit\npre-commit install\npytest -q\n```\n\n### Guidelines\nOpen an issue before large changes.\nKeep examples pure-Python (no notebooks) and save images to examples/gallery/out/.\nRun ruff and the pre-commit hooks; keep PRs focused and small.\nAdd or update a test when changing behavior.\nSee [contributing](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/docs/CONTRIBUTING.md) for details.\n\n## Code of Conduct\nWe follow the [Contributor Covenant](https://raw.githubusercontent.com/ale-tom/bbcstyle/main/docs/CODE_OF_CONDUCT.md). By participating, you agree to uphold this standard.\n\n## Authorship & credits\nCreated and maintained by Alessandro Tomassini (@ale-tom).\nThanks to contributors and the broader visualization community for inspiration. Any similarities to BBC graphics are purely stylistic; this project is independent of the BBC.\n\n## Citation\nIf this package helps your work, please cite it:\n```bibtex\n@software{bbcstyle,\n title = {bbcstyle: BBC-inspired theme for Matplotlib/Seaborn},\n author = {Alessandro Tomassini},\n year = {2025},\n version = {0.1.0},\n url = {https://github.com/ale-tom/bbcstyle}\n}\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "BBC-inspired Matplotlib/Seaborn theme for clean, publication-ready charts.",
"version": "0.1.1",
"project_urls": {
"Changelog": "https://github.com/ale-tom/bbcstyle/releases",
"Contact": "https://github.com/ale-tom/bbcstyle/issues/new/choose",
"Homepage": "https://github.com/ale-tom/bbcstyle",
"Issues": "https://github.com/ale-tom/bbcstyle/issues"
},
"split_keywords": [
"matplotlib",
" seaborn",
" theme",
" visualization",
" bbc"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1af5a7346a563e7b35c0634fac9b39d20f3380d003255fafb9adde5083088092",
"md5": "c1dfd8908a8eeed537553fb861a4de03",
"sha256": "d1c09125e53d55894c72c62a0e9009dd817a714a70ca9e8e53dbd9e04539dbd6"
},
"downloads": -1,
"filename": "bbcstyle-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c1dfd8908a8eeed537553fb861a4de03",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7890,
"upload_time": "2025-10-17T22:37:53",
"upload_time_iso_8601": "2025-10-17T22:37:53.773586Z",
"url": "https://files.pythonhosted.org/packages/1a/f5/a7346a563e7b35c0634fac9b39d20f3380d003255fafb9adde5083088092/bbcstyle-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "52f5395912ca47f58197265701e02d790bd1b34701ac54fa50d446657ca18973",
"md5": "fd299f07a0f811bbb15ad2dd41f633e6",
"sha256": "d89d3aa63abfe26e8ebef91c9fc8a136731670ee05fc6bf6603378dfb11f00a1"
},
"downloads": -1,
"filename": "bbcstyle-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "fd299f07a0f811bbb15ad2dd41f633e6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 8404,
"upload_time": "2025-10-17T22:37:54",
"upload_time_iso_8601": "2025-10-17T22:37:54.925603Z",
"url": "https://files.pythonhosted.org/packages/52/f5/395912ca47f58197265701e02d790bd1b34701ac54fa50d446657ca18973/bbcstyle-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-17 22:37:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ale-tom",
"github_project": "bbcstyle",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "bbcstyle"
}