S&P Global charting style according to EDP style guideline
Project description
S&P Global EDP Chart Style for Python
Disclaimer: This is NOT an official package provided by S&P Global. It is a community-driven project created by analysts to style visualizations in Python. Please reach out to support.energy@spglobal.com for official support, and more information on the use of S&P Global data.
A Python implementation of the S&P Global Editorial, Design & Publishing (EDP) standards for data visualization using Matplotlib. This package ensures your charts adhere to strict brand guidelines regarding colors, typography, layout, and formatting.
🚀 Key Features
- Strict Brand Colors: Full access to the S&P Global color palette (Levels 1-12) for all brand colors.
- Theming: Native support for Standard Light and Standard Dark modes.
- Auto-Styling: Specialized methods to style bar charts, line charts, and dual-axis charts according to EDP rules.
- Intelligent Layout:
- EDP Figure Sizing:
get_edp_figsize()returns exact dimensions for digital reports (Word/InDesign) or PowerPoint (16x9). - Header/Footer Management: Automatic footnote generation including dynamic "As of" dates, source attribution, and copyright.
- Legend Positioning: Automatically aligns legends to the top with smart column calculation.
- EDP Figure Sizing:
- Advanced Formatting:
- Forecast Tints: Automatically apply lighter tints for forecast data.
- Monochromatic Palettes: Compliant palettes for 2 to 5 classes.
- Date Alignment: Standardized 3-letter month abbreviations (Jan, Feb, Sep, etc.) without periods.
📦 Installation
This project is managed by Poetry.
git clone https://github.com/kovzhu/spg_style.git
cd spg_style
poetry install
🛠 Usage
1. Basic Setup in Jupyter Notebook
To see changes reflected immediately when editing spg_style.py, use %autoreload:
%load_ext autoreload
%autoreload 2
import spg_style as spg
import matplotlib.pyplot as plt
# Initialize the EDP style (sets global rcParams)
style = spg.SpglobalStyle(theme='light')
2. Creating an EDP Compliant Chart
import pandas as pd
# 1. Get the correct dimensions for a half-page report graphic
figsize = spg.get_edp_figsize(width="full", height="1/2", target="report")
fig, ax = plt.subplots(figsize=figsize)
# 2. Plot your data
data = pd.Series([10, 15, 7, 12], index=['Q1', 'Q2', 'Q3', 'Q4 (F)'])
bars = ax.bar(data.index, data.values)
# 3. Apply EDP styling rules
# - tints Q4 if marked as forecast
# - adds value labels
# - sets standard bar widths
style.style_bar_single(ax, bars, is_forecast_mask=[False, False, False, True])
# 4. Final Polish
style.set_y_unit_label(ax, "USD Millions")
style.add_footnotes(fig, source="S&P Global Commodity Insights")
plt.show()
🎨 Color Palette
The package provides the full SPG_FULL dictionary containing hex codes transcribed from the EDP guidelines.
from spg_style import SPG_FULL
# Access Maroon Level 7
primary_color = SPG_FULL["Maroon"][7]
# Access Sentiment colors
from spg_style import SENTIMENT
positive_color = SENTIMENT["positive"]
🏗 Project Structure
spg_style/spg_style.py: The core engine containing theSpglobalStyleclass and color definitions.notebook/notebook.ipynb: Examples and scratchpad for testing new chart styles.pyproject.toml: Dependency management and project metadata.
📄 Reference
This implementation is based on the S&P Global EDP Visual Style Guide (Jan 2026).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spg_style-0.1.2.tar.gz.
File metadata
- Download URL: spg_style-0.1.2.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.0 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c43a8040725023f521eb106026b24fae10fec52d3986bd4d21283bd1871d79a
|
|
| MD5 |
6e1d8128e96afc60bea8657d3b66e11b
|
|
| BLAKE2b-256 |
1a3de5bbb416c10864cb14a4374934668647714dd8c72eb1dfd8aa8e7f8d46b6
|
File details
Details for the file spg_style-0.1.2-py3-none-any.whl.
File metadata
- Download URL: spg_style-0.1.2-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.0 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90571422e1532245ed386352fac8edecd1cc478bbbd09004af657b5cdc4fd7b4
|
|
| MD5 |
d91a0e5b6c17f142221c7be0115e7f00
|
|
| BLAKE2b-256 |
44c097eee3d5f2e01e5fd27574ae424b7a65600452d83201be28cfbf2ff74624
|