pip install plotting_backendsThe plotting_backends library provides a set of classes that can be used for
dispatching plotting functions to different backends.
The common base class is AbstractPlottingBackend and the pre-defined backends
are:
MatplotlibBackendSeabornBackendPlotlyBackendBokehBackendAltairBackendGGPlotBackend
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!