Skip to main content

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.
  • 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 the SpglobalStyle class 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spg_style-0.1.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

spg_style-0.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file spg_style-0.1.1.tar.gz.

File metadata

  • Download URL: spg_style-0.1.1.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

Hashes for spg_style-0.1.1.tar.gz
Algorithm Hash digest
SHA256 671ebb5dcaf4f46a5242e06a601420defc7d656d5ed34e975b389bd1fdb6625e
MD5 a23fd419894f09561e85c3d952607d3e
BLAKE2b-256 73bdc2d15789cc7a82911bd05f0c846cff36f3285318c6451d58c724c6927261

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spg_style-0.1.1-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

Hashes for spg_style-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3a7c0c5bd9ec7ecd17ecb75b342bda4599f8a5cb7ff5cf922c30c1fc0f825cc
MD5 77228e80f2c8de5b81512a3078219f1c
BLAKE2b-256 e00d27c39c56ac36db6b0122f01d6ab8a03a09c75b63c1ffbc5c968d095ecf2c

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