Business day axis scale for matplotlib
Project description
busdayaxis
A Matplotlib scale that compresses non-business days and off-hours. Every visible unit on the axis corresponds to active time — no gaps for weekends, holidays, or overnight periods. No data preprocessing needed.
Full documentation at saemeon.github.io/busdayaxis
Why
Time series that only evolve on business days — prices, signals, operational metrics — look distorted on a standard calendar axis: weekends and holidays introduce flat gaps that compress active periods and visually skew slopes. busdayaxis removes those gaps entirely.
What it provides
- Compress weekends, holidays, and overnight gaps with a single
set_xscale("busday")call - Implemented as a proper
ScaleBasesubclass — autoscaling, shared axes, and all standard artists work without any changes to your plotting code - Per-day session hours (
bushours) — uniform, per-weekday list, or dict with sensible defaults - Custom weekmasks and holiday lists, compatible with NumPy's busday calendar
- Business-day-aware wrappers for all standard Matplotlib date locators — each filters ticks to business days and hours automatically
MidBusdayLocatorto place a tick at the midpoint of each business session, useful for centering day labelsBusdayLocatorbase class to wrap any custom or third-party locator
Installation
pip install busdayaxis
Quick Start
import matplotlib.pyplot as plt
import busdayaxis
busdayaxis.register_scale() # register once at the start of your script
fig, ax = plt.subplots()
ax.plot(dates, values)
ax.set_xscale("busday") # compress weekends (Mon–Fri default)
License
BSD 3-Clause
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
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 busdayaxis-0.1.1.tar.gz.
File metadata
- Download URL: busdayaxis-0.1.1.tar.gz
- Upload date:
- Size: 68.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7e23cb94d34d30ff381856fc38db5dbf1d6b5ef6a5637d5acc71b9f2bc3f6ab
|
|
| MD5 |
b106d3b9fe69e9aee3f92f701d521ea1
|
|
| BLAKE2b-256 |
eea8039bb0e4e12341a7628dd9d795f8356e6bbb1d49de0f4a87d76f0420a65b
|
File details
Details for the file busdayaxis-0.1.1-py3-none-any.whl.
File metadata
- Download URL: busdayaxis-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1177daf552a65f6eb7019183762ab1a9ef4a1dc97bfabd3c84b668513ef5505
|
|
| MD5 |
1492c606329caea0ddc37f3fb97de195
|
|
| BLAKE2b-256 |
57f27461b6f9a58bf34043ba1f29bed7024581852725da6251daac3e15b74ee5
|