edifice.extra.MatplotlibFigure

edifice.extra.MatplotlibFigure#

class edifice.extra.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 (Callable[[Axes], None]) – Function which takes matplotlib Axes and calls Axes.plot.

  • on_figure_mouse_move (Optional[Callable[[MouseEvent], 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)

Sets the key of the 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.