Plotting utilities
- class pyballmapper.plotting.graph_GUI(graph, my_palette, tooltips_variables=[], figsize=(800, 600), output_format='svg', render_seed=42, render_iterations=100, MIN_SIZE=7, MAX_SIZE=20)
Bases:
object
Create a Bokeh plot rapresenting the BallMapper graph.
- Parameters:
graph (NetworkX graph) – The Graph attribute of a BallMapper object.
my_palette (matplotlib palette) – The color palette used to color the nodes.
tooltips_variables (list of strings, default=None) – Which variables to show in the mouse hovertool.
figsize (tuple, default=(800, 600)) – The figure size.
output_format (string, default='svg') – The format in which the save button saves the plot.
render_seed (int, default=42) – Seed for the networkx spring_layout.
render_iterations (int, default=100) – Number of iterations for the networkx spring_layout.
MIN_SIZE (int, default=7) – Minimal size of the graph nodes.
int (MAX_SIZE;) – Maximal size of the graph nodes.
default=20 – Maximal size of the graph nodes.
- Graph
The BallMapper graph. Each node correspond to a covering ball and has attributes: ‘landmark’ the id of the corresponding landmark point ‘points covered’ the ids of the points covered by the corresponding ball
- Type:
NetworkX Graph object
- eps
The input radius of the balls.
- Type:
float
- points_covered_by_landmarks
keys: landmarks ids values: list of ids of the points covered by the corresponding ball
- Type:
dict
- add_colorbar(num_ticks, low, high)
Add a colorbar to the right side of the Bokeh plot.
- Parameters:
num_ticks (int) – Number of ticks, use a high number (100) for a continuos looking colorbar.
low (float) – Value at the bottom of the colorbar.
high (float) – Value at the top of the colorbar.
- color_by_variable(variable, MIN_VALUE=inf, MAX_VALUE=-inf, logscale=False)
Color the BallMapper Bokeh plot nodes using a specific variable.
Coloring data can be added using the BallMapper.add_coloring() method. MIN_VALUE and MAX_VALUE are computed automatically, but lower (resp. higher) values can be manually specified.
- Parameters:
variable (string) – Which coloring variable to use.
MIN_VALUE (float, default=np.inf) – Minimum value for the coloring palette.
MAX_VALUE (float, default=-np.inf) – Maximum value for the coloring palette.
logscale (bool, default=False) – Wheter to use a logscale coloring. If False, linear is used.
- color_edges()
color edges by interpolating between the nodes’ colors
- pyballmapper.plotting.kmapper_visualize(bm, coloring_df, path_html='output.html', title=None, **kwargs)
leverages kepler-mapper visualization tool to produce an interactive html. https://kepler-mapper.scikit-tda.org
- Parameters:
bm (BallMapper) – the BallMapper graph to plot
coloring_df (pandas.DataFrame) – pandas dataframe of shape (n_samples, n_coloring_function)
path_html (str, optional) – the output file, by default ‘output.html’
title (string, optional) – title to be displayed in the top bar, by default None