busdayaxis 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. busdayaxis-0.0.1/.github/ISSUE_TEMPLATE/bug_report.md +44 -0
  2. busdayaxis-0.0.1/.github/ISSUE_TEMPLATE/config.yml +6 -0
  3. busdayaxis-0.0.1/.github/ISSUE_TEMPLATE/documentation.md +29 -0
  4. busdayaxis-0.0.1/.github/ISSUE_TEMPLATE/feature_request.md +34 -0
  5. busdayaxis-0.0.1/.github/workflows/lint.yml +9 -0
  6. busdayaxis-0.0.1/.github/workflows/publish.yml +25 -0
  7. busdayaxis-0.0.1/.github/workflows/test.yml +32 -0
  8. busdayaxis-0.0.1/.gitignore +158 -0
  9. busdayaxis-0.0.1/.pre-commit-config.yaml +26 -0
  10. busdayaxis-0.0.1/CONTRIBUTING.md +73 -0
  11. busdayaxis-0.0.1/LICENSE +29 -0
  12. busdayaxis-0.0.1/PKG-INFO +115 -0
  13. busdayaxis-0.0.1/README.md +70 -0
  14. busdayaxis-0.0.1/docs/api.md +6 -0
  15. busdayaxis-0.0.1/docs/index.md +32 -0
  16. busdayaxis-0.0.1/examples/README.md +1 -0
  17. busdayaxis-0.0.1/examples/plot_busday.py +66 -0
  18. busdayaxis-0.0.1/examples/plot_stock_volume.py +73 -0
  19. busdayaxis-0.0.1/mkdocs.yml +114 -0
  20. busdayaxis-0.0.1/pyproject.toml +82 -0
  21. busdayaxis-0.0.1/readthedocs.yml +12 -0
  22. busdayaxis-0.0.1/setup.cfg +4 -0
  23. busdayaxis-0.0.1/src/busdayaxis/__init__.py +8 -0
  24. busdayaxis-0.0.1/src/busdayaxis/_locator.py +42 -0
  25. busdayaxis-0.0.1/src/busdayaxis/_scale.py +139 -0
  26. busdayaxis-0.0.1/src/busdayaxis/_version.py +34 -0
  27. busdayaxis-0.0.1/src/busdayaxis.egg-info/PKG-INFO +115 -0
  28. busdayaxis-0.0.1/src/busdayaxis.egg-info/SOURCES.txt +32 -0
  29. busdayaxis-0.0.1/src/busdayaxis.egg-info/dependency_links.txt +1 -0
  30. busdayaxis-0.0.1/src/busdayaxis.egg-info/requires.txt +25 -0
  31. busdayaxis-0.0.1/src/busdayaxis.egg-info/top_level.txt +1 -0
  32. busdayaxis-0.0.1/tests/__init__.py +0 -0
  33. busdayaxis-0.0.1/tests/test_locator.py +20 -0
  34. busdayaxis-0.0.1/tests/test_scale.py +39 -0
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: 🐛 Bug Report
3
+ about: Report a bug
4
+ # based on matplotlib issue template
5
+ ---
6
+
7
+ <!--To help us understand and resolve your issue, please fill out the form to the best of your ability.-->
8
+ <!--You can feel free to delete the sections that do not apply.-->
9
+
10
+ ### Bug report
11
+
12
+ **Bug summary**
13
+
14
+ <!--A short 1-2 sentences that succinctly describes the bug-->
15
+
16
+ **Code for reproduction**
17
+
18
+ <!--A minimum code snippet required to reproduce the bug.
19
+ Please make sure to minimize the number of dependencies required, and provide
20
+ any necessary plotted data.
21
+
22
+ ```python
23
+ # Paste your code here
24
+ #
25
+ #
26
+ ```
27
+
28
+ **Actual outcome**
29
+
30
+ <!--The output produced by the above code, which may be a screenshot, console output, etc.-->
31
+
32
+ **Expected outcome**
33
+
34
+ <!--A description of the expected outcome from the code snippet-->
35
+ <!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on-->
36
+
37
+ **Version Info**
38
+ <!--Please specify your platform and versions of the relevant libraries you are using:-->
39
+ * Operating system:
40
+ * Matplotlib version:
41
+ * Matplotlib backend (`print(matplotlib.get_backend())`):
42
+ * Python version:
43
+ * Jupyter version (if applicable):
44
+ * Other libraries:
@@ -0,0 +1,6 @@
1
+ # Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
2
+ blank_issues_enabled: true # default
3
+ contact_links:
4
+ - name: ❓ Question/Support/Other
5
+ url: https://discourse.matplotlib.org/c/3rdparty/18
6
+ about: If you have a usage question
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: 📖 Documentation improvement
3
+ about: Report parts of the docs that are wrong or unclear
4
+ labels: documentation, bug
5
+ ---
6
+
7
+ <!--To help us understand and resolve your issue, please fill out the form to the best of your ability.-->
8
+ <!--You can feel free to delete the sections that do not apply.-->
9
+
10
+ ### Problem
11
+
12
+ <!--
13
+ If you are referencing an existing piece of documentation or example please provide a link.
14
+
15
+ * I found [...] to be unclear because [...]
16
+ * [...] made me think that [...] when really it should be [...]
17
+ * There is no example showing how to do [...]
18
+ -->
19
+
20
+
21
+ ### Suggested Improvement
22
+
23
+ <!--
24
+ If you have an idea to improve the documentation please suggest it here
25
+
26
+ * This line should be be changed to say [...]
27
+ * Include a paragraph explaining [...]
28
+ * Add a figure showing [...]
29
+ -->
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: 🚀 Enhancement/Feature Request
3
+ about: Suggest something that could be improved or a New Feature to add
4
+ labels: enhancement
5
+ ---
6
+
7
+ <!--
8
+ Welcome! Thanks for thinking of a way to improve busdayaxis. If this solves a problem for you, then it probably solves that problem for lots of people! So the whole community will benefit from this request.
9
+
10
+
11
+ Before creating a new feature request please search the issues for relevant feature requests.
12
+ -->
13
+
14
+ ### Problem
15
+
16
+ <!-- Provide a clear and concise description of what problem this feature will solve. For example:
17
+
18
+ * I'm always frustrated when [...] because [...]
19
+ * I would like it if [...] happened when I [...] because [...]
20
+ -->
21
+
22
+ ### Proposed Solution
23
+
24
+ <!-- Provide a clear and concise description of a way to accomplish what you want. For example:
25
+
26
+ * Add an option so that when [...] [...] will happen
27
+ -->
28
+
29
+ ### Additional context
30
+
31
+ <!-- Add any other context or screenshots about the feature request here. You can also include links to examples of other programs that have something similar to your request. For example:
32
+
33
+ * Another project [...] solved this by [...]
34
+ -->
@@ -0,0 +1,9 @@
1
+ name: Prek checks
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ prek:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v6
9
+ - uses: j178/prek-action@v1
@@ -0,0 +1,25 @@
1
+ name: Publish Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ deploy:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Set up Python
13
+ uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.x"
16
+ - name: Install dependencies
17
+ run: |
18
+ python -m pip install --upgrade pip
19
+ pip install build
20
+ - name: Build package
21
+ run: python -m build
22
+ - name: Publish to PyPI
23
+ uses: pypa/gh-action-pypi-publish@release/v1
24
+ with:
25
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,32 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ name: Python ${{ matrix.python-version }}
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+ cache: "pip"
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ pip install --upgrade pip
29
+ pip install ".[test]"
30
+
31
+ - name: Tests
32
+ run: pytest
@@ -0,0 +1,158 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .env
109
+ .venv
110
+ env/
111
+ venv/
112
+ ENV/
113
+ env.bak/
114
+ venv.bak/
115
+
116
+ # Spyder project settings
117
+ .spyderproject
118
+ .spyproject
119
+
120
+ # Rope project settings
121
+ .ropeproject
122
+
123
+ # mkdocs documentation
124
+ /site
125
+ docs/generated
126
+
127
+
128
+ # mypy
129
+ .mypy_cache/
130
+ .dmypy.json
131
+ dmypy.json
132
+
133
+ # Pyre type checker
134
+ .pyre/
135
+
136
+ # pytype static type analyzer
137
+ .pytype/
138
+
139
+ # Cython debug symbols
140
+ cython_debug/
141
+
142
+ # mac stuff
143
+ .DS_store
144
+
145
+ # editors
146
+
147
+ ## vim
148
+ [._]*.s[a-v][a-z]
149
+ !*.svg # comment out if you don't need vector files
150
+ [._]*.sw[a-p]
151
+ [._]s[a-rt-v][a-z]
152
+ [._]ss[a-gi-z]
153
+ [._]sw[a-p]
154
+ [._]*.un~
155
+
156
+ ## vscode
157
+ .vscode
158
+ .python-version
@@ -0,0 +1,26 @@
1
+ minimum_prek_version: "0.2.0"
2
+
3
+ repos:
4
+ - repo: builtin
5
+ hooks:
6
+ - id: trailing-whitespace
7
+ - id: check-added-large-files
8
+ - id: check-case-conflict
9
+ - id: end-of-file-fixer
10
+ - id: fix-byte-order-marker
11
+ - id: check-json
12
+ - id: check-json5
13
+ - id: check-toml
14
+ - id: check-yaml
15
+ - id: check-xml
16
+ - id: mixed-line-ending
17
+ - id: check-symlinks
18
+ - id: check-merge-conflict
19
+ - id: detect-private-key
20
+ - id: check-executables-have-shebangs
21
+ - repo: https://github.com/astral-sh/ruff-pre-commit
22
+ rev: v0.9.0
23
+ hooks:
24
+ - id: ruff
25
+ args: [--fix]
26
+ - id: ruff-format
@@ -0,0 +1,73 @@
1
+ ============
2
+ Contributing
3
+ ============
4
+
5
+ Thanks for thinking of a way to help improve this library! Remember that contributions come in all
6
+ shapes and sizes beyond writing bug fixes. Contributing to documentation, opening new `issues <https://github.com//busdayaxis/issues>`_,
7
+ asking for clarification on things you find unclear, and requesting new features, are all super valuable contributions.
8
+
9
+ Code Improvements
10
+ -----------------
11
+
12
+ All development for this library happens at https://github.com//busdayaxis,
13
+
14
+ First set up a dev environment. The instructions here use `mamba <https://github.com/mamba-org/mamba#mamba>`_ which is open source
15
+ implementation of `conda` that offers significant speed ups. You can substitute ``conda`` for ``mamba`` or use ``venv`` without any ill-effects.
16
+
17
+ .. code-block:: bash
18
+
19
+ mamba create -n busdayaxis-dev python
20
+ conda activate busdayaxis-dev
21
+
22
+ Now clone your fork of the Git repository and make an editable (``-e``) install.
23
+
24
+ .. code-block:: bash
25
+
26
+ git clone <your fork>
27
+ cd busdayaxis
28
+ pip install -e ".[dev]"
29
+
30
+
31
+ Working with Git
32
+ ^^^^^^^^^^^^^^^^
33
+
34
+ Using Git/Github can confusing (https://xkcd.com/1597/) so if you're new to Git, you may find
35
+ it helpful to use a program like `Github Desktop <desktop.github.com>`_ and to follow
36
+ a `guide <https://github.com/firstcontributions/first-contributions#first-contributions>`_.
37
+
38
+ Also feel free to ask for help/advice on the relevant Github `issue <https://github.com//busdayaxis/issues>`_.
39
+
40
+ Documentation
41
+ -------------
42
+
43
+ Following changes to the source files, you can view recent adjustments by building the documentation.
44
+
45
+ 1. Make sure you have installed the requirements for building the documentation:
46
+
47
+ .. code-block:: bash
48
+
49
+ cd busdayaxis
50
+ pip install -e ".[doc]"
51
+
52
+ 2. Run the following commands:
53
+
54
+ .. code-block:: bash
55
+
56
+ cd docs
57
+ make html
58
+
59
+ If you open the ``_build/html/index.html`` file in your browser you should now be able to see the rendered documentation.
60
+
61
+ Autobuild the documentation
62
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
63
+
64
+ Alternatively, you can use `sphinx-autobuild <https://github.com/GaretJax/sphinx-autobuild>`_ to continuously watch the documentation for changes and rebuild it for you.
65
+ Sphinx-autobuild will be installed automatically by the above ``pip`` command, and we've added it to the ``Makefile``. All you need to do is:
66
+
67
+ .. code-block:: bash
68
+
69
+ cd docs
70
+ make watch
71
+
72
+ In a few seconds your web browser should open up the documentation. Now whenever you save a file
73
+ the documentation will automatically regenerate and the webpage will refresh for you!
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Simon Niederberger
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its contributors
17
+ may be used to endorse or promote products derived from this software
18
+ without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: busdayaxis
3
+ Version: 0.0.1
4
+ Summary: Business day axis scale for matplotlib
5
+ Author-email: Simon Niederberger <s.niederberger@hotmail.com>
6
+ Maintainer-email: Simon Niederberger <s.niederberger@hotmail.com>
7
+ License-Expression: BSD-3-Clause
8
+ Project-URL: Homepage, https://saemeon.github.io/busdayaxis/
9
+ Project-URL: Repository, https://github.com/saemeon/busdayaxis
10
+ Keywords: matplotlib,business day,busday,matplotlib-scale
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Framework :: Matplotlib
18
+ Classifier: Operating System :: OS Independent
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: matplotlib
23
+ Requires-Dist: numpy
24
+ Requires-Dist: pandas
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest; extra == "test"
27
+ Requires-Dist: pytest-cov; extra == "test"
28
+ Provides-Extra: doc
29
+ Requires-Dist: mkdocs; extra == "doc"
30
+ Requires-Dist: mkdocs-material; extra == "doc"
31
+ Requires-Dist: mkdocs-gallery; extra == "doc"
32
+ Requires-Dist: mkdocstrings[python]; extra == "doc"
33
+ Requires-Dist: mike; extra == "doc"
34
+ Provides-Extra: dev
35
+ Requires-Dist: ruff; extra == "dev"
36
+ Requires-Dist: prek; extra == "dev"
37
+ Requires-Dist: pytest; extra == "dev"
38
+ Requires-Dist: pytest-cov; extra == "dev"
39
+ Requires-Dist: mkdocs; extra == "dev"
40
+ Requires-Dist: mkdocs-material; extra == "dev"
41
+ Requires-Dist: mkdocs-gallery; extra == "dev"
42
+ Requires-Dist: mkdocstrings[python]; extra == "dev"
43
+ Requires-Dist: mike; extra == "dev"
44
+ Dynamic: license-file
45
+
46
+ # busdayaxis
47
+
48
+ [![PyPI](https://img.shields.io/pypi/v/busdayaxis)](https://pypi.org/project/busdayaxis/)
49
+ [![License](https://img.shields.io/badge/License-BSD--3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
50
+
51
+ ## Business-day axis support for Matplotlib.
52
+
53
+ `busdayaxis` provides a custom Matplotlib scale that compresses non-business days and displays time in continuous business-day space.
54
+ - Useful when your data has no weekend activity and is naturally defined in business-day units.
55
+ - Integrates directly with Matplotlib’s transformation and autoscaling machinery.
56
+ - No data preprocessing is required.
57
+ - Custom business calendars are supported.
58
+
59
+ ## Motivation
60
+ Many time series evolve in business time rather than calendar time:
61
+ - Equity prices
62
+ - Trading signals
63
+ - Portfolio returns
64
+ - Risk metrics
65
+ - Operational KPIs
66
+
67
+ When plotted on a standard calendar axis, weekends introduce artificial gaps that visually distort slopes and compress active trading periods.
68
+ `busdayaxis` removes these inactive periods by mapping calendar datetimes to continuous business-day units.
69
+
70
+ ## Installation
71
+ You can install using `pip`:
72
+
73
+ ```bash
74
+ pip install busdayaxis
75
+ ```
76
+
77
+ ## Quick Start
78
+
79
+ ```python
80
+ import matplotlib.pyplot as plt
81
+ import busdayaxis
82
+
83
+ busdayaxis.register_scale()
84
+
85
+ ax.plot(dates, values)
86
+ ax.set_xscale("busday")
87
+ ```
88
+
89
+
90
+ ## Custom Business Calendars
91
+
92
+ 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.
93
+
94
+ ```python
95
+ ax.set_xscale(
96
+ "busday",
97
+ weekmask="Mon Tue Wed Thu Fri",
98
+ holidays=["2025-01-01", "2025-12-25"],
99
+ )
100
+ ```
101
+
102
+ This makes it possible to model exchange holidays or company-specific calendars.
103
+
104
+ ## Matplotlib Integration
105
+
106
+ - The busday scale is implemented as a proper ScaleBase subclass and:
107
+ - Participates in Matplotlib’s transform pipeline
108
+ - Works with autoscaling
109
+ - Works with shared axes and subplots
110
+ - Supports all artists that go through the standard data transformation system
111
+ - This includes plot, scatter, bar, vlines, fill_between, and other common Matplotlib objects.
112
+
113
+ ## License
114
+
115
+ BSD 3-Clause
@@ -0,0 +1,70 @@
1
+ # busdayaxis
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/busdayaxis)](https://pypi.org/project/busdayaxis/)
4
+ [![License](https://img.shields.io/badge/License-BSD--3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
5
+
6
+ ## Business-day axis support for Matplotlib.
7
+
8
+ `busdayaxis` provides a custom Matplotlib scale that compresses non-business days and displays time in continuous business-day space.
9
+ - Useful when your data has no weekend activity and is naturally defined in business-day units.
10
+ - Integrates directly with Matplotlib’s transformation and autoscaling machinery.
11
+ - No data preprocessing is required.
12
+ - Custom business calendars are supported.
13
+
14
+ ## Motivation
15
+ Many time series evolve in business time rather than calendar time:
16
+ - Equity prices
17
+ - Trading signals
18
+ - Portfolio returns
19
+ - Risk metrics
20
+ - Operational KPIs
21
+
22
+ When plotted on a standard calendar axis, weekends introduce artificial gaps that visually distort slopes and compress active trading periods.
23
+ `busdayaxis` removes these inactive periods by mapping calendar datetimes to continuous business-day units.
24
+
25
+ ## Installation
26
+ You can install using `pip`:
27
+
28
+ ```bash
29
+ pip install busdayaxis
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```python
35
+ import matplotlib.pyplot as plt
36
+ import busdayaxis
37
+
38
+ busdayaxis.register_scale()
39
+
40
+ ax.plot(dates, values)
41
+ ax.set_xscale("busday")
42
+ ```
43
+
44
+
45
+ ## Custom Business Calendars
46
+
47
+ 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.
48
+
49
+ ```python
50
+ ax.set_xscale(
51
+ "busday",
52
+ weekmask="Mon Tue Wed Thu Fri",
53
+ holidays=["2025-01-01", "2025-12-25"],
54
+ )
55
+ ```
56
+
57
+ This makes it possible to model exchange holidays or company-specific calendars.
58
+
59
+ ## Matplotlib Integration
60
+
61
+ - The busday scale is implemented as a proper ScaleBase subclass and:
62
+ - Participates in Matplotlib’s transform pipeline
63
+ - Works with autoscaling
64
+ - Works with shared axes and subplots
65
+ - Supports all artists that go through the standard data transformation system
66
+ - This includes plot, scatter, bar, vlines, fill_between, and other common Matplotlib objects.
67
+
68
+ ## License
69
+
70
+ BSD 3-Clause
@@ -0,0 +1,6 @@
1
+ # API Reference
2
+
3
+ ::: busdayaxis
4
+ options:
5
+ show_source: true
6
+ members_order: source