An open API service indexing awesome lists of open source software.

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.

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