edifice.extra.matplotlib_figure.MatplotlibFigure#

class edifice.extra.matplotlib_figure.MatplotlibFigure(plot_fun, on_figure_mouse_move=None, **kwargs)[source]#

Bases: QtWidgetElement

A matplotlib Figure.

Requires matplotlib.

Example:

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)
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.

Methods

__init__(plot_fun[, on_figure_mouse_move])

register_ref(reference)

Registers provided Reference to this Element.

set_key(key)

Set the key of an Element.

Attributes

children

The children of this Element.

props

The props of this Element.

underlying

The underlying QWidget, which may not exist if this Element has not rendered.