Skip to main content

Business day axis scale for matplotlib

Project description

busdayaxis

PyPI License

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.

Remove weekend gaps

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 ScaleBase subclass — 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
  • MidBusdayLocator to place a tick at the midpoint of each business session, useful for centering day labels
  • BusdayLocator base 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

busdayaxis-0.1.1.tar.gz (68.9 kB view details)

Uploaded Source

Built Distribution

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

busdayaxis-0.1.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

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

Hashes for busdayaxis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e7e23cb94d34d30ff381856fc38db5dbf1d6b5ef6a5637d5acc71b9f2bc3f6ab
MD5 b106d3b9fe69e9aee3f92f701d521ea1
BLAKE2b-256 eea8039bb0e4e12341a7628dd9d795f8356e6bbb1d49de0f4a87d76f0420a65b

See more details on using hashes here.

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

Hashes for busdayaxis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1177daf552a65f6eb7019183762ab1a9ef4a1dc97bfabd3c84b668513ef5505
MD5 1492c606329caea0ddc37f3fb97de195
BLAKE2b-256 57f27461b6f9a58bf34043ba1f29bed7024581852725da6251daac3e15b74ee5

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