edifice.extra.matplotlib_figure.MatplotlibFigure#
- class edifice.extra.matplotlib_figure.MatplotlibFigure(plot_fun, on_figure_mouse_move=None, **kwargs)[source]#
Bases:
QtWidgetElement[FigureCanvasQTAgg]A matplotlib Figure.
Requires matplotlib.
Props
All props from
edifice.QtWidgetElementplus:- Parameters:
plot_fun (tp.Callable[[Axes], None]) – Function which takes matplotlib Axes and calls Axes.plot.
on_figure_mouse_move (tp.Callable[[MouseEvent], None] | None) – Handler for mouse move MouseEvent.
Usage
from matplotlib.axes import Axes import numpy as np from edifice.extra import MatplotlibFigure def plot_fun(ax:Axes): time_range = np.linspace(-10, 10, num=120) ax.plot(time_range, np.sin(time_range)) MatplotlibFigure(plot_fun=plot_fun)
Methods
__init__(plot_fun[, on_figure_mouse_move])register_ref(reference)Registers provided
Referenceto this Element.set_key(key)Set the key of an
Element.Attributes
childrenThe children of this Element.
propsThe props of this Element.
underlyingThe underlying QWidget, which may not exist if this Element has not rendered.