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.0.tar.gz (68.8 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.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file busdayaxis-0.1.0.tar.gz.

File metadata

  • Download URL: busdayaxis-0.1.0.tar.gz
  • Upload date:
  • Size: 68.8 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.0.tar.gz
Algorithm Hash digest
SHA256 646a6b94ba146bbbc564cb2ca86b1926f9114cfcf4fbce99ca914e48369771cf
MD5 3c1b6c0f1b0f48c2213107e47d53ff75
BLAKE2b-256 372e8aac56780450255242dbf5692f5b98df2354c7eaeeac7dc84030bb927055

See more details on using hashes here.

File details

Details for the file busdayaxis-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: busdayaxis-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c99e4a7c3a983ef09e0935fe63323fc7c7b1cf129e3d2302ae0f1884f205dfd2
MD5 f7396ce4c05ab982a32641d576a4019d
BLAKE2b-256 64aad520c921fdf4707c2ad662976e5504c97cb1bd01cc845c110b01dbf62272

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