pylbo.visualisation.figure_window
Classes
Class to handle the top-level creation of figure windows. Assigns unique figure |
|
Subclass to handle interactivity in the figure windows. |
Module Contents
- class pylbo.visualisation.figure_window.FigureWindow(fig: matplotlib.figure.Figure)
Class to handle the top-level creation of figure windows. Assigns unique figure ids and takes care of figure, axes, and gridspec management.
- Parameters:
fig (Figure) – The figure object.
- figure_stack
- fig
- figsize
- figure_id
- _figure_drawn = False
- create_default_figure(figlabel: str, figsize: tuple[int, int]) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]
Creates a default figure with a 1x1 subplot.
- make_layout_tight() None
Calls tight_layout() on a figure and captures the userwarning introduced in matplotlib 3.5.
- add_subplot_axes(ax: matplotlib.axes.Axes, loc: str = 'right', share: str = None, apply_tight_layout: bool = True)
Adds a new subplot to a given matplotlib subplot, essentially “splitting” the axis into two. Position and placement depend on the loc argument. When called on a more complex subplot layout the overall gridspec remains untouched, only the ax object has its gridspec modified. On return, tight_layout() is called by default to prevent overlapping labels.
- Parameters:
ax (Axes) – The axes object, this will be “split” and a new axes will be added to the figure.
loc (str) – The location of the new axes. Should be one of “left”, “right”, “top”, “bottom”. Defaults to “right”.
share (str) – Can be “x”, “y” or “all”. This locks axes zooming between both subplots.
apply_tight_layout (bool) – Whether to call tight_layout() on the figure before return.
- Raises:
ValueError – If the loc argument is invalid.
- Returns:
The axes instance that was added.
- Return type:
- show()
Shows the selected figure
- class pylbo.visualisation.figure_window.InteractiveFigureWindow(fig: matplotlib.figure.Figure)
Bases:
FigureWindow
Subclass to handle interactivity in the figure windows.
- _mpl_callbacks = []
- make_legend_interactive(legendhandler: pylbo.visualisation.legend_handler.LegendHandler) None
Makes the legend interactive.
- Parameters:
legendhandler (LegendHandler) – The legend handler.
- add_eigenfunction_interface(efhandler: pylbo.visualisation.eigenfunctions.eigfunc_interface.EigenfunctionInterface) None
Adds an eigenfunction interface to the figure.
- Parameters:
efhandler ()
EigenfunctionInterface – The eigenfunction interface.