qten.plottings
Package reference for qten.plottings.
Registered Plot Methods
For the user-facing obj.plot(...) methods registered by the plotting extension, see Plot Methods.
plottings
Core plotting dispatch layer for QTen objects.
This package defines the lightweight plotting interface used by QTen and its
plotting extensions. Backend-specific implementations may live elsewhere, but
objects become plottable by inheriting from the exported base class and
registering plotting methods. Users normally interact with this layer through
calls such as obj.plot("heatmap", backend="plotly").
Exports
PlottableBase class providing backend-aware plot-method registration and dispatch.
Notes
The concrete plot object types exposed to users are primarily documented in
qten_plots, while this package focuses on the shared dispatch
mechanism. The generated API page links to the Plot Methods index for the
registered obj.plot(...) calls.
Exported API
Plottable
Bases: ABC
Base class for objects that dispatch plotting calls to registered backends.
Plottable does not implement plotting directly. Instead, backend packages
register functions under (object type, method name, backend name) keys.
Users call plot() on the object they want
to visualize, and the dispatcher finds the matching registered function
through the object's method-resolution order.
Repository usage
The qten-plots extension registers Plotly and Matplotlib implementations
through the qten.plottings entry-point group. Those implementations remain
private backend details; the public user-facing API is the dispatcher call,
for example tensor.plot("heatmap", backend="plotly").
register_plot_method
classmethod
register_plot_method(name: str, backend: str = 'plotly')
Register a backend plotting function for this plottable class.
The returned decorator stores the function in the global plotting
registry. Registered functions receive the object being plotted as their
first argument, followed by any extra positional and keyword arguments
supplied to plot().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
User-facing plot method name, such as |
required |
backend
|
str
|
Backend name that selects the implementation. The |
'plotly'
|
Returns:
| Type | Description |
|---|---|
Callable
|
Decorator that registers the provided plotting function and returns it unchanged. |
Source code in src/qten/plottings/_plottings.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
plot
plot(method: str, backend: str = 'plotly', *args, **kwargs)
Dispatch a named plot method to a registered backend implementation.
The dispatcher first loads plotting entry points, then searches the
instance type and its base classes for a matching (type, method,
backend) registration. Additional arguments are forwarded unchanged to
the selected backend function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Plot method name registered for this object's type. |
required |
backend
|
str
|
Backend implementation to use. The |
'plotly'
|
args
|
Positional arguments forwarded to the registered plotting function. |
()
|
|
kwargs
|
Keyword arguments forwarded to the registered plotting function. |
{}
|
Returns:
| Type | Description |
|---|---|
object
|
Backend-specific figure object returned by the registered plotting function, such as a Plotly or Matplotlib figure. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no plotting function is registered for the requested method and backend on this object. |
See Also
qten_plots.plottables.PointCloud Public plottable helper object provided by the plotting extension.
Source code in src/qten/plottings/_plottings.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |