geomstats.visualization package#

Submodules#

geomstats.visualization.hyperbolic module#

Visualization for Geometric Statistics.

class geomstats.visualization.hyperbolic.KleinDisk(points=None)[source]#

Bases: object

add_points(points)[source]#
static convert_to_klein_coordinates(points)[source]#
draw(ax, **kwargs)[source]#
plot(points, ax=None, **point_draw_kwargs)[source]#
static set_ax(ax=None)[source]#

Set axis.

class geomstats.visualization.hyperbolic.PoincareDisk(points=None, coords_type='extrinsic')[source]#

Bases: object

add_points(points)[source]#
static convert_to_poincare_coordinates(points)[source]#
draw(ax, **kwargs)[source]#
plot(points, ax=None, coords_type=None, **point_draw_kwargs)[source]#
static set_ax(ax=None)[source]#

Set axis.

class geomstats.visualization.hyperbolic.PoincareHalfPlane(points=None, coords_type='half-space')[source]#

Bases: object

Class used to plot points in the Poincare Half Plane.

add_points(points)[source]#
static convert_to_half_plane_coordinates(points)[source]#
draw(ax, **kwargs)[source]#
plot(points, ax=None, coords_type=None, **point_draw_kwargs)[source]#
set_ax(ax=None)[source]#

Set axis.

geomstats.visualization.hypersphere module#

Visualization for Geometric Statistics.

class geomstats.visualization.hypersphere.Circle(n_angles=100, points=None)[source]#

Bases: object

Class used to draw a circle.

add_points(points)[source]#

Add points.

draw(ax, **plot_kwargs)[source]#

Plot circle shape.

draw_points(ax, points=None, **plot_kwargs)[source]#

Plot points.

plot(points, ax=None, **point_draw_kwargs)[source]#

Plot points in the circle.

static set_ax(ax=None)[source]#

Set axis.

class geomstats.visualization.hypersphere.Sphere(n_meridians=40, n_circles_latitude=None, points=None)[source]#

Bases: object

Create the arrays sphere_x, sphere_y, sphere_z to plot a sphere.

Create the arrays sphere_x, sphere_y, sphere_z of values to plot the wireframe of a sphere. Their shape is (n_meridians, n_circles_latitude).

add_points(points)[source]#

Add points.

draw(ax, **scatter_kwargs)[source]#

Plot sphere shape.

draw_points(ax, points=None, **scatter_kwargs)[source]#

Plot points.

get_fibonnaci_points(n_points=16000)[source]#

Get spherical Fibonacci point sets.

Point sets are yield nearly uniform point distributions on the unit sphere.

plot(points, ax=None, **point_draw_kwargs)[source]#

Plot points in the sphere.

plot_heatmap(ax, scalar_function, n_points=16000, alpha=0.2, cmap='jet')[source]#

Plot a heatmap defined by a loss on the sphere.

static set_ax(ax=None)[source]#

Set axis.

geomstats.visualization.poincare_polydisk module#

Visualization for Geometric Statistics.

class geomstats.visualization.poincare_polydisk.PoincarePolyDisk(points=None, coords_type='ball', n_disks=2)[source]#

Bases: object

Class used to plot points in the Poincare polydisk.

add_points(points)[source]#

Add points to draw.

clear_points()[source]#

Clear the points to draw.

static convert_to_poincare_coordinates(points)[source]#

Convert points to poincare coordinates.

draw(ax, **kwargs)[source]#

Draw.

static set_ax(ax=None)[source]#

Define the ax parameters.

geomstats.visualization.pre_shape module#

Visualization for Geometric Statistics.

class geomstats.visualization.pre_shape.KendallDisk(points=None, coords_type='pre-shape')[source]#

Bases: object

Class used to plot points in Kendall shape space of 3D triangles.

The shape space of 2D triangles is isometric to the 2-sphere of radius 1/2 [K1984]. This isometry induced another isometry between the shape space of 3D triangle and the 1-ball of radius pi/4 [LK1993]. Following the first visualization class “KendallSphere” for 2D triangles, this class encodes the 2D isometric representation of Kendall shape space of order (3,3).

points#

List of points to plot on the Kendall sphere.

Type:

list

coords_type#

Type of the points. Can be either ‘pre-shape’ (for points in Kendall pre-shape space) or ‘extrinsic’ (for points given as 3x2 matrices). Optional, default: ‘pre-shape’.

Type:

str

pole#

Equilateral triangle in 2D (north pole).

Type:

array-like, shape=[3,2]

centre#

Equilateral triangle in 3D (centre).

Type:

array-like, shape=[3,3]

ua#

Tangent vector at north pole toward isosceles triangle at vertex A.

Type:

array-like, shape=[3,2]

ub#

Tangent vector at north pole toward isosceles triangle at vertex B.

Type:

array-like, shape=[3,2]

na#

Tangent vector such that (ua,na) is a positively oriented orthonormal basis of the horizontal space at north pole.

Type:

array-like, shape=[3,2]

References

[K1984]

David G. Kendall. “Shape Manifolds, Procrustean Metrics, and Complex Projective Spaces.” Bulletin of the London Mathematical Society, Volume 16, Issue 2, March 1984, Pages 81–121. https://doi.org/10.1112/blms/16.2.81

[LK1993]

Huiling Le and David G. Kendall. “The Riemannian structure of Euclidean shape spaces: a novel environment for statistics.” Annals of statistics, 1993, vol. 21, no 3, p. 1225-1271. https://doi.org/10.1112/blms/16.2.81

add_points(points)[source]#

Add points to draw on the Kendall disk.

clear_points()[source]#

Clear the points to draw.

convert_to_planar_coordinates(points)[source]#

Convert polar coordinates to spherical one.

convert_to_polar_coordinates(points)[source]#

Assign polar coordinates to given pre-shapes.

draw(n_r=7, n_theta=25, scale=0.05)[source]#

Draw the disk regularly sampled with corresponding triangles.

draw_curve(alpha=1, zorder=0, **kwargs)[source]#

Draw a curve on the Kendall disk.

draw_points(alpha=1, zorder=0, **kwargs)[source]#

Draw points on the Kendall disk.

draw_triangle(r, theta, scale)[source]#

Draw the corresponding triangle on the disk at r, theta.

draw_vector(tangent_vec, base_point, tol=0.001, **kwargs)[source]#

Draw one vector in the tangent space to disk at a base point.

set_ax(ax=None)[source]#

Set axis.

class geomstats.visualization.pre_shape.KendallSphere(points=None, coords_type='pre-shape')[source]#

Bases: object

Class used to plot points in Kendall shape space of 2D triangles.

David G. Kendall showed that the shape space of 2D triangles is isometric to the 2-sphere of radius 1/2 [K1984]. This class encodes this isometric representation, offering a 3D visualization of Kendall shape space of order (3,2), and its related objects.

points#

List of points to plot on the Kendall sphere.

Type:

list

coords_type#

Type of the points. Can be either ‘pre-shape’ (for points in Kendall pre-shape space) or ‘extrinsic’ (for points given as 3x2 matrices). Optional, default: ‘pre-shape’.

Type:

str

pole#

Equilateral triangle (north pole).

Type:

array-like, shape=[3,2]

ua#

Tangent vector toward isosceles triangle at vertex A.

Type:

array-like, shape=[3,2]

ub#

Tangent vector toward isosceles triangle at vertex B.

Type:

array-like, shape=[3,2]

na#

Tangent vector such that (ua,na) is a positively oriented orthonormal basis of the horizontal space at north pole.

Type:

array-like, shape=[3,2]

References

[K1984]

David G. Kendall. “Shape Manifolds, Procrustean Metrics, and Complex Projective Spaces.” Bulletin of the London Mathematical Society, Volume 16, Issue 2, March 1984, Pages 81–121. https://doi.org/10.1112/blms/16.2.81

add_points(points)[source]#

Add points to draw on the Kendall sphere.

clear_points()[source]#

Clear the points to draw.

convert_to_polar_coordinates(points)[source]#

Assign polar coordinates to given pre-shapes.

convert_to_spherical_coordinates(points)[source]#

Convert polar coordinates to spherical one.

draw(n_theta=25, n_phi=13, scale=0.05, elev=60.0, azim=0.0)[source]#

Draw the sphere regularly sampled with corresponding triangles.

draw_curve(alpha=1, zorder=0, **kwargs)[source]#

Draw a curve on the Kendall sphere.

draw_points(alpha=1, zorder=0, **kwargs)[source]#

Draw points on the Kendall sphere.

draw_triangle(theta, phi, scale)[source]#

Draw the corresponding triangle on the sphere at theta, phi.

draw_vector(tangent_vec, base_point, **kwargs)[source]#

Draw one vector in the tangent space to sphere at a base point.

static rotation(theta, phi)[source]#

Rotation sending a triangle at pole to location theta, phi.

set_ax(ax=None)[source]#

Set axis.

set_view(elev=60.0, azim=0.0)[source]#

Set azimuth and elevation angle.

geomstats.visualization.spd_matrices module#

Visualization for Geometric Statistics.

class geomstats.visualization.spd_matrices.Ellipses(k_sampling_points=100)[source]#

Bases: object

Class used to plot points on the manifold SPD(2).

Elements S of the manifold of 2D Symmetric Positive Definite matrices can be conveniently represented by ellipses.

We write \(S = O D O^T\) with \(O\) an orthogonal matrix (rotation) and \(D\) a diagonal matrix. The positive eigenvalues, i.e. the elements of \(D\), are the inverse of the length of the major and minor axes of the ellipse. The rotation matrix \(O\) determines the orientation of the 2D ellipse in the 2D plane.

Parameters:

k_sampling_points (int) – Number of points to sample on the discretized ellipses.

compute_coordinates(point)[source]#

Compute the ellipse coordinates of a 2D SPD matrix.

Parameters:

point (array-like, shape=[2, 2]) – SPD matrix.

Returns:

  • x_coords (array-like, shape=[k_sampling_points,]) – x_coords coordinates of the sampling points on the discretized ellipse.

  • Y (array-like, shape = [k_sampling_points,]) – y coordinates of the sampling points on the discretized ellipse.

draw_points(points=None, ax=None, **plot_kwargs)[source]#

Draw the ellipses.

Parameters:
  • ax (Axis) – Axis of the figure.

  • points (array-like, shape=[…, 2, 2]) – Points on the SPD manifold of 2D symmetric positive definite matrices. Optional, default: None.

  • plot_kwargs (dict) – Dictionary of arguments related to plotting.

static set_ax(ax=None)[source]#

Set the axis for the Figure.

Parameters:

ax (Axis) – Axis of the figure.

Returns:

ax (Axis) – Axis of the figure.

geomstats.visualization.special_euclidean module#

Visualization for Geometric Statistics.

class geomstats.visualization.special_euclidean.SpecialEuclidean2(points=None, point_type='matrix')[source]#

Bases: object

Class used to plot points in the 2d special euclidean group.

add_points(points)[source]#
draw_points(ax, points=None, **kwargs)[source]#
static set_ax(ax=None, x_lim=None, y_lim=None)[source]#

geomstats.visualization.special_orthogonal module#

Visualization for Geometric Statistics.

class geomstats.visualization.special_orthogonal.Arrow3D(point, vector)[source]#

Bases: object

An arrow in 3d, i.e. a point and a vector.

draw(ax, **quiver_kwargs)[source]#

Draw the arrow in 3D plot.

class geomstats.visualization.special_orthogonal.Trihedron(point, vec_1, vec_2, vec_3)[source]#

Bases: object

A trihedron, i.e. 3 Arrow3Ds at the same point.

draw(ax, **arrow_draw_kwargs)[source]#

Draw the trihedron by drawing its 3 Arrow3Ds.

Arrows are drawn is order using green, red, and blue to show the trihedron’s orientation.

plot(points, ax=None, space=None, **point_draw_kwargs)[source]#
geomstats.visualization.special_orthogonal.convert_to_trihedron(point, space=None)[source]#

Transform a rigid point into a trihedron.

Transform a rigid point into a trihedron such that:

  • the trihedron’s base point is the translation of the origin of R^3 by the translation part of point,

  • the trihedron’s orientation is the rotation of the canonical basis of R^3 by the rotation part of point.

geomstats.visualization.special_orthogonal.plot(points, ax=None, space=None, **point_draw_kwargs)[source]#

Plot trihedrons.

Module contents#

The Visualization Package.

geomstats.visualization.plot(points, ax=None, space=None, coords_type=None, **point_draw_kwargs)[source]#

Plot points in one of the implemented manifolds.

The implemented manifolds are:

  • the special orthogonal group SO(3)

  • the special Euclidean group SE(3)

  • the circle S1 and the sphere S2

  • the hyperbolic plane (the Poincare disk, the Poincare half plane and the Klein disk)

  • the Poincare polydisk

  • the Kendall shape space of 2D triangles

  • the Kendall shape space of 3D triangles

Parameters:
  • points (array-like, shape=[…, dim]) – Points to be plotted.

  • space (str, optional, {‘SO3_GROUP’, ‘SE3_GROUP’, ‘S1’, ‘S2’,) – ‘H2_poincare_disk’, ‘H2_poincare_half_plane’, ‘H2_klein_disk’, ‘poincare_polydisk’, ‘S32’, ‘M32’, ‘S33’, ‘M33’, ‘SPD2’}

  • coords_type (str, optional, {‘extrinsic’, ‘ball’, ‘half-space’, ‘pre-shape’})

geomstats.visualization.tutorial_matplotlib()[source]#

Configure style for matplotlib tutorial.