bregman.visualizer.matplotlib package

Submodules

bregman.visualizer.matplotlib.callback module

class bregman.visualizer.matplotlib.callback.Visualize2DTissotIndicatrix(scale: float = 0.1, npoints: int = 1000)

Bases: VisualizerCallback[MatplotlibVisualizer]

Callback to visualize the Tissot indicatrix for the metric tensor of 2D manifolds.

Parameters:
  • scale – Scale of the radius of the Tissot indicatrix ellipsoid being plotted.

  • npoints – Number of points used to generate the Tissot indicatrix.

call(obj: BregmanObject, coords: Coords, visualizer: MatplotlibVisualizer, **kwargs) None

Plots ellipsoid of the Tissot indicatrix for points in 2D Bregman manifolds. The callback accepts any type of BregmanObject and only creates this visualization if it is a Point of compatible dimension.

Visualization only occurs in the \(\lambda\)-coordinates.

Parameters:
  • obj – Objects being plotted.

  • coords – Coordinates the Tissot indicatrix is being evaluated on.

  • visualizer – Visualizer the callback is being called in.

  • **kwargs – Additional kwargs passed to matplotlib plot function.

Raises:

ValueError – Raises exception when visualizer’s manifold is incompatible.

class bregman.visualizer.matplotlib.callback.VisualizeGaussian2DCovariancePoints(scale: float = 0.2, npoints: int = 1000)

Bases: VisualizerCallback[MatplotlibVisualizer]

Callback to visualize the covariance matrix of points in 2D Gaussian manifolds.

Parameters:
  • scale – Scale of the radius of the covariance ellipsoid being plotted.

  • npoints – Number of points used to generate the covariance ellipsoid.

call(obj: BregmanObject, coords: Coords, visualizer: MatplotlibVisualizer, **kwargs) None

Plots ellipsoid of the covariance matrix for points in 2D Gaussian manifolds. The callback accepts any type of BregmanObject and only creates this visualization if it is a Point of compatible dimension.

Visualization only occurs in the \(\lambda\)-coordinates.

Parameters:
  • obj – Objects being plotted.

  • coords – Coordinates the covariance matrix is being evaluated on.

  • visualizer – Visualizer the callback is being called in.

  • **kwargs – Additional kwargs passed to matplotlib plot function.

Raises:

ValueError – Raises exception when visualizer’s manifold is incompatible.

bregman.visualizer.matplotlib.matplotlib module

class bregman.visualizer.matplotlib.matplotlib.DataLim(coords: Coords, xmin: ndarray, xmax: ndarray, ymin: ndarray, ymax: ndarray)

Bases: object

The axis limits of the data being visualizer.

Parameters:
  • coords – Coordinate the data is being visualized in.

  • xmin – Minimum x-values.

  • xmax – Maximum x-values.

  • ymin – Minimum y-values.

  • ymax – Maximum y-values.

coords: Coords
xmax: ndarray
xmin: ndarray
ymax: ndarray
ymin: ndarray
class bregman.visualizer.matplotlib.matplotlib.MatplotlibVisualizer(manifold: BregmanManifold, plot_dims: tuple[int, int], dim_names: tuple[str, str] | None = None, resolution: int = 120, frames: int = 120, intervals: int = 1)

Bases: BregmanVisualizer

Visualization class using matplotlib as a visualization back-end. Allows the visualization of geometric objects in a Bregman objects over two dimension axis.

Parameters:
  • dim1 – Axis 1 for visualization.

  • dim2 – Axis 2 for visualization.

  • dim_names – Tuple of names used to describe visualization axis.

  • resolution – Resolution of calculating curves in the visualizer.

  • frames – Number of frames used in animation.

  • intervals – Delay between frames in milliseconds.

  • rdelta – Resolution time delta for evaluating curves parameterized in [0, 1].

  • delta – Animation time delta for evaluating curves parameterized in [0, 1].

  • fig – Matplotlib figure for plotting.

  • ax – Matplotlib axis for plotting.

  • update_func_list – Update function list for matplotlib animation.

animate_geodesic(coords: Coords, geodesic: Geodesic, **kwargs) None

Matplotlib animation function for Geodesic objects.

Parameters:
  • coords – Coordinate for object to be animted in.

  • geodesic – Bisector object to be animated.

  • **kwargs – Additional kwargs passed to matplotlib plot function.

calculate_lims(coords: Coords, cut: float = 1.0) DataLim

Calculate the data limits (data axis bounds) for the current objects which will be plotted in the visualizer.

Parameters:
  • coords – Coordinate for object to be plotted in.

  • cut – Cut percentage to remove from axis bounds being calculated.

Returns:

plot_bisector(coords: Coords, bisector: Bisector, **kwargs) None

Matplotlib plotting function for Bisector objects.

Parameters:
  • coords – Coordinate for object to be plotted in.

  • bisector – Bisector object to be plotted.

  • **kwargs – Additional kwargs passed to matplotlib plot function.

plot_geodesic(coords: Coords, geodesic: Geodesic, **kwargs) None

Matplotlib plotting function for Geodesic objects.

Parameters:
  • coords – Coordinate for object to be plotted in.

  • geodesic – Geodesic object to be plotted.

  • **kwargs – Additional kwargs passed to matplotlib plot function.

plot_point(coords: Coords, point: Point, **kwargs) None

Matplotlib plotting function for Point objects.

Parameters:
  • coords – Coordinate for object to be plotted in.

  • point – Point object to be plotted.

  • **kwargs – Additional kwargs passed to matplotlib scatter function.

save(coords: Coords, path: Path | str) None

Visualize all registered plots and then save the visualization for the designated path.

Parameters:
  • coords – Coordinate the visualization is being made in.

  • path – Save path for visualization.

visualize(coords: Coords) None

Visualize all registered plots and animations and then run matplotlib’s show function.

Parameters:

coords – Coordinate the visualization is being made in.

Module contents