milia.plot.bind#

Binding backend-independent figures to one drawing backend.

Functions

bind(draw, figures)

Every public figure of a module with its draw argument fixed to one backend.

milia.plot.bind.bind(draw, figures)#

Every public figure of a module with its draw argument fixed to one backend.

This is how milia.plot.lets and milia.plot.mpl expose the same figures under the same names while each is written only once.

Parameters:
  • draw (ModuleType) – Drawing backend module (milia.plot.lets.draw or milia.plot.mpl.draw).

  • figures (ModuleType) – Module of figure functions taking draw first.

Return type:

dict[str, Callable]

Returns:

Figure name to the bound function, keeping its docstring and signature (minus draw).

Examples

>>> from milia.plot.figures import clusters
>>> from milia.plot.mpl import draw
>>> "scatter" in bind(draw, clusters)
True