kmapper.plotlyviz.plotlyviz¶
- kmapper.plotlyviz.plotlyviz(scomplex, colorscale=None, title='Kepler Mapper', graph_layout='kk', color_values=None, color_function_name=None, node_color_function='mean', dashboard=False, graph_data=False, factor_size=3, edge_linewidth=1.5, node_linecolor='rgb(200,200,200)', width=600, height=500, bgcolor='rgba(240, 240, 240, 0.95)', left=10, bottom=35, summary_height=300, summary_width=600, summary_left=20, summary_right=20, hist_left=25, hist_right=25, member_textbox_width=800, filename=None)[source]¶
Visualizations and dashboards for kmapper graphs using Plotly. This method is suitable for use in Jupyter notebooks.
The generated FigureWidget can be updated (by performing a restyle or relayout). For example, let us add a title to the colorbar (the name of the color function, if any), and set the title font size. To perform these updates faster, Plotly 3.+ provides a context manager that batches up all data and layout updates:
To display more info on the generated kmapper-graph, define two more FigureWidget(s): the global node distribution figure, and a dummy figure that displays info on the algorithms involved in getting the graph from data, as well as sklearn class instances.
A FigureWidget has event listeners for hovering, clicking or selecting. Using the first one for fw_graph we define, via the function hovering_widgets(), widgets that display the node distribution, when the node is hovered over, and two textboxes for the cluster size and the member ids/labels of the hovered node members.
- Parameters:
scomplex (dict) – Simplicial complex is the output from the KeplerMapper map method.
title (str) – Title of output graphic
graph_layout (igraph layout;) – recommended ‘kk’ (kamada-kawai) or ‘fr’ (fruchterman-reingold)
colorscale – Plotly colorscale(colormap) to color graph nodes
dashboard (bool, default is False) – If true, display complete dashboard of node information
graph_data (bool, default is False) – If true, display graph metadata
factor_size (double, default is 3) – a factor for the node size
edge_linewidth (double, default is 1.5)
node_linecolor (color str, default is "rgb(200,200,200)")
width (int, default is 600,)
height (int, default is 500,)
bgcolor (color str, default is "rgba(240, 240, 240, 0.95)",)
left (int, default is 10,)
bottom (int, default is 35,)
summary_height (int, default is 300,)
summary_width (int, default is 600,)
summary_left (int, default is 20,)
summary_right (int, default is 20,)
hist_left (int, default is 25,)
hist_right (int, default is 25,)
member_textbox_width (int, default is 800,)
filename (str, default is None) – if filename is given, the graphic will be saved to that file.
- Returns:
result (plotly.FigureWidget) – A FigureWidget that can be shown or editted. See the Plotly Demo notebook for examples of use.
scikit-tda/kepler-mapper