pip install plotting_backends
This shows how to use plotting_backends
with functools.singledispatch
.
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: ...
This example shows how to use plotting_backends
in conjunction with plum
, a
multiple dispatch library.
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: ...
We welcome contributions!