Skip to main content

Business day axis scale for matplotlib

Project description

busdayaxis

PyPI License

Business-day axis support for Matplotlib.

busdayaxis provides a custom Matplotlib scale that compresses non-business days and displays time in continuous business-day space.

  • Useful when your data has no weekend activity and is naturally defined in business-day units.
  • Integrates directly with Matplotlib’s transformation and autoscaling machinery.
  • No data preprocessing is required.
  • Custom business calendars are supported.

Motivation

Many time series evolve in business time rather than calendar time:

  • Equity prices
  • Trading signals
  • Portfolio returns
  • Risk metrics
  • Operational KPIs

When plotted on a standard calendar axis, weekends introduce artificial gaps that visually distort slopes and compress active trading periods. busdayaxis removes these inactive periods by mapping calendar datetimes to continuous business-day units.

Installation

You can install using pip:

pip install busdayaxis

Quick Start

import matplotlib.pyplot as plt
import busdayaxis

busdayaxis.register_scale()

ax.plot(dates, values)
ax.set_xscale("busday")

Custom Business Calendars

The scale supports all keyword arguments accepted by NumPy’s business-day functions (is_busday, busday_count, busday_offset). This allows custom weekmasks and holiday lists.

ax.set_xscale(
    "busday",
    weekmask="Mon Tue Wed Thu Fri",
    holidays=["2025-01-01", "2025-12-25"],
)

This makes it possible to model exchange holidays or company-specific calendars.

Matplotlib Integration

  • The busday scale is implemented as a proper ScaleBase subclass and:
  • Participates in Matplotlib’s transform pipeline
  • Works with autoscaling
  • Works with shared axes and subplots
  • Supports all artists that go through the standard data transformation system
  • This includes plot, scatter, bar, vlines, fill_between, and other common Matplotlib objects.

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.0.1.tar.gz (15.1 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.0.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: busdayaxis-0.0.1.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for busdayaxis-0.0.1.tar.gz
Algorithm Hash digest
SHA256 88e593778860b408d9dc73ebd82551b4ec63e066327065d805d0e35bf3328e08
MD5 37da7603f4a25dc9d06dded4f024d58d
BLAKE2b-256 4437217c69fab7d78674abc3cde2ccdf3f676d1273d51a08b9db6d2cf564ce55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: busdayaxis-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 27ee6284a203683ffa5f065fbb7193d3c65c40a16f8a75dd2a7a524619df4d29
MD5 cb4f578faac9de330e165829e0aca212
BLAKE2b-256 c08269ecab83f230a2d76a8ee4e595e806835eb4c9a13bc2e9fd8b40e8c787ef

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