https://github.com/galacticdynamics/plotting_backends
Plotting dispatch backends.
https://github.com/galacticdynamics/plotting_backends
matplotlib multiple-dispatch plotting python
Last synced: 9 months ago
JSON representation
Plotting dispatch backends.
- Host: GitHub
- URL: https://github.com/galacticdynamics/plotting_backends
- Owner: GalacticDynamics
- License: mit
- Created: 2024-09-24T16:44:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-09T03:52:31.000Z (10 months ago)
- Last Synced: 2025-04-09T04:28:11.508Z (10 months ago)
- Topics: matplotlib, multiple-dispatch, plotting, python
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
plotting_backends
plotting dispatch backends
## Installation
[![PyPI platforms][pypi-platforms]][pypi-link]
[![PyPI version][pypi-version]][pypi-link]
```bash
pip install plotting_backends
```
## Examples
### `functools.singledispatch`
This shows how to use `plotting_backends` with `functools.singledispatch`.
```python
import plotting_backends
from functools import singledispatch
@singledispatch
def plotting_func(
backend: type[plotting_backends.AbstractPlottingBackend], x: Any, y: Any
) -> None: ...
@plotting_func.register
def matplotlib(
backend: type[plotting_backends.MatplotlibBackend], x: Any, y: Any
) -> None: ...
```
### `plum` (multiple dispatch)
This example shows how to use `plotting_backends` in conjunction with `plum`, a
multiple dispatch library.
```python
import plotting_backends
from plum import dispatch
@dispatch.abstract
def plotting_func(
backend: type[plotting_backends.AbstractPlottingBackend], x: Any, y: Any
) -> None: ...
@dispatch
def plotting_func(
backend: type[plotting_backends.MatplotlibBackend], x: Any, y: Any
) -> None: ...
```
## Development
[![Actions Status][actions-badge]][actions-link]
[![ruff status][ruff-badge]][ruff-link]
We welcome contributions!
[actions-badge]: https://github.com/GalacticDynamics/plotting_backends/workflows/CI/badge.svg
[actions-link]: https://github.com/GalacticDynamics/plotting_backends/actions
[pypi-link]: https://pypi.org/project/plotting_backends/
[pypi-platforms]: https://img.shields.io/pypi/pyversions/plotting_backends
[pypi-version]: https://img.shields.io/pypi/v/plotting_backends
[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
[ruff-link]: https://github.com/astral-sh/ruff