chartbook.plotting.backends#
Backend loading and registration for chartbook.plotting.
A backend is any object satisfying the PlottingBackend protocol: a
name and the create_* methods. Backends are called directly, by
method. They are kept in a pluggy plugin manager, which serves here as a
registry and as the loader for the chartbook_plotting entry-point group
and nothing more. The interface is documented for third-party authors in
docs_src/guide/plotting-backends.md.
Package Contents#
Functions#
Get a plotting backend by name. |
|
Get or create the plugin manager. |
|
List all available backend names. |
|
Register a custom plotting backend. |
Data#
API#
- chartbook.plotting.backends.ENTRY_POINT_GROUP#
‘chartbook_plotting’
- chartbook.plotting.backends.get_backend(name: str = 'plotly') chartbook.plotting.backends._base.PlottingBackend[source]#
Get a plotting backend by name.
Parameters
name : str Backend name. Options: “plotly”, “matplotlib”, or any registered plugin name.
Returns
PlottingBackend The requested backend implementation.
Raises
ValueError If the backend name is not found.
- chartbook.plotting.backends.get_plugin_manager() pluggy.PluginManager[source]#
Get or create the plugin manager.
- chartbook.plotting.backends.list_backends() list[str][source]#
List all available backend names.
Returns
list[str] Names of all registered backends, sorted.
- chartbook.plotting.backends.register_backend(backend, name: str | None = None) None[source]#
Register a custom plotting backend.
Parameters
backend : PlottingBackend or type A backend instance, or a backend class to instantiate. name : str, optional Name for the backend. If not provided, uses backend.name.
Raises
TypeError If the object is not a usable backend.
Examples
Third-party packages can also register via entry points, naming either a backend class or an instance:
[project.entry-points.chartbook_plotting] my_backend = "mypackage.backend:MyBackend"