Visualization

Inheritance diagram of hermespy.core.visualize.Visualizable, hermespy.core.visualize.VisualizableAttribute, hermespy.core.visualize.Visualization, hermespy.core.visualize.PlotVisualization, hermespy.core.visualize.StemVisualization, hermespy.core.visualize.ScatterVisualization, hermespy.core.visualize.ImageVisualization, hermespy.core.visualize.QuadMeshVisualization

The visualization module provides classes for streamlining the process of creating and updating real-time data visualizations using matolotlib.

class Visualizable[source]

Bases: Generic[VT], ABC

Base class for visualizable results.

create_figure(**kwargs)[source]

Create a new figure for plotting.

Returns: Newly generated figure and axes to plot into.

Return type:

Tuple[FigureBase, ndarray[Tuple[int, int], dtype[Any]]]

update_visualization(visualization=None, **kwargs)[source]

Update an existing visualization with new data.

Parameters:

visualization (VT, optional) – The visualization to update. If not specified, the most recent visualization will be updated.

Raises:

RuntimeError – If no visualization is provided and no visualization is cached.

Return type:

None

visualize(axes=None, *, title=None, **kwargs)[source]

Generate a visual representation of this object using Matplotlib.

Parameters:
  • axes (VAT | plt.Axes, optional) – The Matplotlib axes object into which the information should be plotted. If not specified, the routine will generate and return a new figure.

  • title (str, optional) – Title of the generated plot. If not specified, Visualizable.title will be applied.

Return type:

TypeVar(VT, bound= Visualization)

Returns: Plotted information including axes and lines.

property title: str

Title of the visualizable.

Returns: Title string.

property visualization: VT | None

The most recent visualization.

class VisualizableAttribute[source]

Bases: Generic[VT], Visualizable[VT]

Base class for attributes mocking plot functions.

class Visualization(figure, axes)[source]

Bases: ABC

Information generated by plotting a Visualizable.

Parameters:
  • figure (plt.FigureBase | None) – The figure containing the plot. May be None if the figure is unknown or unavailable.

  • axes (VAT) – The individual axes contained within the figure. A numpy object array of shape (nrows, ncols) containing matplotlib axes.

show()[source]

Show this visualization only.

Note that, depending on the visualizuation, this may be a blocking command.

Return type:

None

property axes: ndarray[Tuple[int, int], dtype[Any]]

The individual axes contained within the figure.

property figure: Figure | None

The figure containing the plot.

class PlotVisualization(figure, axes, lines)[source]

Bases: Visualization

Information generated by plotting a Visualizable.

Parameters:
  • figure (plt.FigureBase) – The figure containing the plot.

  • axes (VAT) – The individual axes contained within the figure. A numpy object array of shape (nrows, ncols) containing matplotlib axes.

  • lines (VLT) – The lines contained within the axes. A numpy object array of shape (nrows, ncols) containing matplotlib lines for each axis.

property lines: ndarray[Tuple[int, int], dtype[Any]]

The lines contained within the axes.

class StemVisualization(figure, axes, container)[source]

Bases: Visualization

Information generated by plotting a Visualizable.

Parameters:
  • figure (plt.FigureBase | None) – The figure containing the plot. May be None if the figure is unknown or unavailable.

  • axes (VAT) – The individual axes contained within the figure. A numpy object array of shape (nrows, ncols) containing matplotlib axes.

  • container (StemContainer) – The container containing the stem plot.

property container: StemContainer

The container containing the stem plot.

class ScatterVisualization(figure, axes, paths)[source]

Bases: Visualization

Information generated by plotting a Visualizable.

Parameters:
  • figure (plt.FigureBase | None) – The figure containing the plot. May be None if the figure is unknown or unavailable.

  • axes (VAT) – The individual axes contained within the figure. A numpy object array of shape (nrows, ncols) containing matplotlib axes.

  • paths (PathCollection) – The path collection representing the scatter plot.

property paths: ndarray[Tuple[int, int], dtype[Any]]

The path collection representing the scatter plot.

class ImageVisualization(figure, axes, image)[source]

Bases: Visualization

Information generated by plotting a Visualizable.

Parameters:
  • figure (plt.FigureBase) – The figure containing the plot.

  • axes (VAT) – The individual axes contained within the figure. A numpy object array of shape (nrows, ncols) containing matplotlib axes.

  • image (AxesImage) – The axes image representing the image plot.

property image: AxesImage

The axes image representing the image plot.

class QuadMeshVisualization(figure, axes, mesh)[source]

Bases: Visualization

Information generated by plotting a Visualizable.

Parameters:
  • figure (plt.FigureBase) – The figure containing the plot.

  • axes (VAT) – The individual axes contained within the figure. A numpy object array of shape (nrows, ncols) containing matplotlib axes.

  • mesh (QuadMesh) – The quad mesh representing the image plot.

property mesh: QuadMesh

The mesh representing the image plot.

class VT

Type variable for a visualization.

alias of TypeVar(‘VT’, bound=Visualization)

VAT

Type alias for a numpy array of matplotlib axes.

VLT

Type alias for a numpy array of matplotlib lines.