topo.plot
Module Contents
Functions
|
Plot the eigenspectrum decay and its first derivatives. |
|
Basic scatter plot function. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plot Riemannian metric using ellipses. Adapted from Megaman (https://github.com/mmp2/megaman). |
|
|
|
|
|
|
|
|
|
|
|
|
|
Create a heatmap from a numpy array and two lists of labels. |
|
A function to annotate a heatmap. |
- topo.plot.decay_plot(evals, title=None, figsize=(9, 5), fontsize=14, label_fontsize=10)
Plot the eigenspectrum decay and its first derivatives.
- Parameters:
evals (Eigenvalues to be visualized.) –
title (Title of the plot.) –
- Returns:
A simple plot of the eigenspectrum decay.
- topo.plot.scatter(res, labels=None, pt_size=5, marker='o', opacity=1, cmap='Spectral', **kwargs)
Basic scatter plot function.
- Parameters:
labels –
pt_size –
marker –
opacity –
cmap –
- topo.plot.scatter3d(res, labels=None, pt_size=5, marker='o', opacity=1, cmap='Spectral')
- topo.plot.hyperboloid(emb, labels=None, pt_size=5, marker='o', opacity=1, cmap='Spectral')
- topo.plot.two_to_3d_hyperboloid(emb)
- topo.plot.poincare(emb, labels=None, pt_size=5, marker='o', opacity=1, cmap='Spectral')
- topo.plot.sphere(emb, labels=None, pt_size=5, marker='o', opacity=1, cmap='Spectral')
- topo.plot.sphere_projection(emb, labels=None, pt_size=5, marker='o', opacity=1, cmap='Spectral')
- topo.plot.toroid(emb, R=3, r=1, labels=None, pt_size=5, marker='o', opacity=1, cmap='Spectral')
- topo.plot.draw_simple_ellipse(position, width, height, angle, ax=None, from_size=0.1, to_size=0.5, n_ellipses=3, alpha=0.1, color=None)
- topo.plot.gaussian_potential(emb, dims=[2, 3, 4], labels=None, pt_size=5, marker='o', opacity=1, cmap='Spectral')
- topo.plot.eval_gaussian(x, pos=np.array([0, 0]), cov=np.eye(2, dtype=np.float32))
- topo.plot.eval_density_at_point(x, embedding)
- topo.plot.get_cmap(n, name='hsv')
- topo.plot.create_density_plot(X, Y, embedding)
- topo.plot.plot_bases_scores(bases_scores, return_plot=True, figsize=(20, 8), fontsize=20)
- topo.plot.plot_graphs_scores(graphs_scores, return_plot=True, figsize=(20, 8), fontsize=20)
- topo.plot.plot_layouts_scores(layouts_scores, return_plot=True, figsize=(20, 8), fontsize=20)
- topo.plot.plot_point_cov(points, nstd=2, ax=None, **kwargs)
- topo.plot.eigsorted(cov)
- topo.plot.plot_cov_ellipse(cov, pos, nstd=1, ax=None, **kwargs)
- topo.plot.plot_riemann_metric(emb, L, H_emb=None, ax=None, n_plot=50, std=1, alpha=0.1, title='Riemannian metric', title_fontsize=10, labels=None, pt_size=1, cmap='Spectral', figsize=(8, 8), random_state=None, **kwargs)
Plot Riemannian metric using ellipses. Adapted from Megaman (https://github.com/mmp2/megaman).
- Parameters:
emb (numpy.ndarray, shape = (n, n_dim)) – Embedding matrix.
L (numpy.ndarray) – Graph Laplacian matrix. Should be provided if H_emb is not provided.
H (Dual Riemann metric, shape = (n, n_dim, n_dim)) – The inverse (dual) Riemann metric matrix at each point. Should be provided if Laplacian is not provided. Computed with the class topo.eval.rmetric.RiemannMetric.
n_plot (int (optional, default 50)) – Number of ellipses to plot.
std (int (optional, default 1)) – Standard deviation of the ellipses. This should be adjusted by hand for visualization purposes.
labels (numpy.ndarray (optional, default None)) – Labels for the points.
pt_size (int (optional, default 1)) – Size of the points.
cmap (str (optional, default 'Spectral')) – Color map for the points.
figsize (tuple (optional, default (8,8))) – Figure size.
random_state (int (optional, default None)) – Random state for sampling points to plot ellipses of.
kwargs (dict) – Additional arguments for matplotlib.
References
“Non-linear dimensionality reduction: Riemannian metric estimation and the problem of geometric discovery”, Dominique Perraul-Joncas, Marina Meila, arXiv:1305.7255
- topo.plot.draw_edges(ax, data, kernel, color='black', **kwargs)
- topo.plot.plot_scores(scores, return_plot=True, log=True, figsize=(8, 3), fontsize=12, title='Scores')
- topo.plot.plot_all_scores(evaluation_dict, log=False, figsize=(20, 8), fontsize=20)
- topo.plot.plot_eigenvectors(eigenvectors, n_eigenvectors=10, labels=None, cmap='tab20', figsize=(23, 2), fontsize=10, title='DC', **kwargs)
- topo.plot.plot_dimensionality_histograms(local_id_dict, global_id_dict, bins=50, title='FSA', histtype='step', stacked=True, density=True, log=False, title_fontsize=22, legend_fontsize=15)
- topo.plot.plot_dimensionality_histograms_multiple(id_dict, bins=50, histtype='step', stacked=True, density=True, log=False, title='I.D. estimates')
- topo.plot.heatmap(data, row_labels, col_labels, ax=None, cbar_kw=None, cbarlabel='', cbar_fontsize=12, shrink=0.6, cb_pad=0.3, **kwargs)
Create a heatmap from a numpy array and two lists of labels.
- Parameters:
data – A 2D numpy array of shape (M, N).
row_labels – A list or array of length M with the labels for the rows.
col_labels – A list or array of length N with the labels for the columns.
ax – A matplotlib.axes.Axes instance to which the heatmap is plotted. If not provided, use current axes or create a new one. Optional.
cbar_kw – A dictionary with arguments to matplotlib.Figure.colorbar. Optional.
cbarlabel – The label for the colorbar. Optional.
**kwargs – All other arguments are forwarded to imshow.
- topo.plot.annotate_heatmap(im, data=None, valfmt='{x:.2f}', textcolors=('black', 'white'), threshold=None, an_fontsize=8, **textkw)
A function to annotate a heatmap.
- Parameters:
im – The AxesImage to be labeled.
data – Data used to annotate. If None, the image’s data is used. Optional.
valfmt – The format of the annotations inside the heatmap. This should either use the string format method, e.g. “$ {x:.2f}”, or be a matplotlib.ticker.Formatter. Optional.
textcolors – A pair of colors. The first is used for values below a threshold, the second for those above. Optional.
threshold – Value in data units according to which the colors from textcolors are applied. If None (the default) uses the middle of the colormap as separation. Optional.
**kwargs – All other arguments are forwarded to each call to text used to create the text labels.