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)[source]
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.
- create_default_figure(figlabel: str, figsize: tuple[int, int]) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] [source]
Creates a default figure with a 1x1 subplot.
- make_layout_tight() None [source]
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)[source]
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:
- class pylbo.visualisation.figure_window.InteractiveFigureWindow(fig: matplotlib.figure.Figure)[source]
Bases:
FigureWindow
Subclass to handle interactivity in the figure windows.
- make_legend_interactive(legendhandler: pylbo.visualisation.legend_handler.LegendHandler) None [source]
Makes the legend interactive.
- Parameters:
legendhandler (LegendHandler) – The legend handler.
- add_eigenfunction_interface(efhandler: pylbo.visualisation.eigenfunctions.eigfunc_interface.EigenfunctionInterface) None [source]
Adds an eigenfunction interface to the figure.
- Parameters:
efhandler ()
EigenfunctionInterface – The eigenfunction interface.