Docs: display
module¶
The functions in this module use matplotlib
to produce plots of
Euler characteristic curves and surfaces.
Contents:
-
euchar.display.
euler_curve_plot
(fig, ax, bins, euler_char_curve, line_color='k', line_width=2, xlabel='Parameter', ylabel='$\\chi(K)$', title='', xlim=None, ylim=None, size_arrows=None, xticks=None, yticks=None, xticks_length=None, xticks_width=None, yticks_length=None, yticks_width=None, xticks_locations=None, yticks_locations=None, font_size_ticks=12)¶ Display an Euler characteristic curve as a piecewise constant curve. plot.
- bins,
np.ndarray, x-axis values of the plot
- euler_char_curve
np.ndarray of integers
- line_color
string, default is “k”
- line_width
int
- xticks, yticks
lists, ticks to plot along axes
- xlabel, ylabel
strings, labels of axes
- title
string
- xlim, ylim
two-tuples, limits of the plot
- xticks_locations, yticks_locations
list of two-tuples
- xticks_spacing, yticks_spacing
two-tuples, delta of space between tick mark and axis
- x_arrow_head_width, x_arrow_head_length
floats
- y_arrow_head_width, y_arrow_head_length
floats
-
euchar.display.
euler_surface_plot
(fig, ax, bins1, bins2, euler_char_surf, n_levels=30, levels=None, min_level=None, max_level=None, xticks=None, yticks=None, colorbar_ticks=None, xlim=None, ylim=None, xlabel='Parametrization 1', ylabel='Parametrization 2', dx=0.05, dy=0.05, title='', color_map='coolwarm')¶ Display an Euler characteristic surface as a piecewise constant contour plot.
- bins1, bin2
np.ndarray, x-axis and y-axis values of the plot
- euler_char_surface
np.ndarray of integers
- n_levels
int, number of levels of the contour plot
- min_levels, max_levels
floats, minimum and maximum level of the contour plot
- xticks, yticks
lists, ticks to plot along axes
- colorbar_ticks
list, ticsk of the colorbar
- xlim, ylim
two-tuples, limits of the plot
- xlabel, ylabel
strings, labels of axes
- dx, dy
floats, resolution parameters of the contour plot. Make these smaller to increase resolution.
- title
string
- color_map
string, default is ‘coolwarm’. Other options are: ‘Greys’, ‘PiYG’, ‘viridis’, ‘magma’, etc.
-
euchar.display.
matplotlib_plot
(rows=1, columns=1, figsize=(4, 4), facecolor='w', font_size=10, font_family='CMU Serif')¶ Returns a fig and ax object.
- rows
int
- cols
int
- figsize
two tuple
- font_size
int
- facecolor
string, default ‘white’.
- font_family
string
- fig, ax
matplotlib plots objects. ax will be an array of axes if rows>1 and/or cols>1
>>> import matplotlib.pyplot as plt >>> from euchar.display import matplotlib_plot >>> from numpy.random import rand >>> points1, points2 = rand(10, 2), rand(1000, 2) >>> fig, ax = matplotlib_plot(1, 2) >>> ax[0].scatter(points1[:,0], points1[:,1], c='red') >>> ax[1].scatter(points2[:,0], points2[:,1], c='blue') >>> plt.show()
-
euchar.display.
piecewise_constant_curve
(domain, curve)¶ Obtain piecewise constant version of a discrete Euler characteristic curve.
-
euchar.display.
piecewise_constant_surface
(bins1, bins2, surface)¶ Obtain the piecewise constant version of a discrete Euler characteristic surface.
-
euchar.display.
visualize_tetrahedron_alpha_parametrization
(tetrahedron, points, figsize=(3, 3))¶ Visualize the miniball of a tetrahedron in 3D.
-
euchar.display.
visualize_triangle_alpha_parametrization
(triangle, points, figsize=(3, 3))¶ Visualize the miniball of a triangle in the plane.
- triangle
- np.ndarray of three integers, the indices of the vertices of the
triangle in points
- points
np.ndarray of shape (N, 2), points in 2 dimensions
- figsize
two-tuple