File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<h1 align =' center ' > plotting_backends </h1 >
2- <h3 align =" center " >Plotting dispatch backends</h3 >
2+ <h3 align =" center " > plotting dispatch backends </h3 >
33
44## Installation
55
1010pip install plotting_backends
1111```
1212
13- ## Documentation
13+ ## Examples
1414
15- ### Getting Started
15+ ### ` functools.singledispatch `
16+
17+ This shows how to use ` plotting_backends ` with ` functools.singledispatch ` .
18+
19+ ``` python
20+ import plotting_backends
21+ from functools import singledispatch
22+
23+
24+ @singledispatch
25+ def plotting_func (
26+ backend : type[plotting_backends.AbstractPlottingBackend], x : Any, y : Any
27+ ) -> None : ...
28+
29+
30+ @plotting_func.register
31+ def matplotlib (
32+ backend : type[plotting_backends.MatplotlibBackend], x : Any, y : Any
33+ ) -> None : ...
34+ ```
35+
36+ ### ` plum ` (multiple dispatch)
37+
38+ This example shows how to use ` plotting_backends ` in conjunction with ` plum ` , a
39+ multiple dispatch library.
1640
1741``` python
1842import plotting_backends
19- import plum
43+ from plum import dispatch
2044
2145
2246@dispatch.abstract
2347def plotting_func (
24- backend : plotting_backends.AbstractPlottingBackend, x : Any, y : Any
48+ backend : type[ plotting_backends.AbstractPlottingBackend] , x : Any, y : Any
2549) -> None : ...
2650
2751
2852@dispatch
2953def plotting_func (
30- backend : plotting_backends.MatplotlibBackend, x : Any, y : Any
54+ backend : type[ plotting_backends.MatplotlibBackend] , x : Any, y : Any
3155) -> None : ...
3256```
3357
You can’t perform that action at this time.
0 commit comments