plot_interactive_mapper_graph

gtda.mapper.visualization.plot_interactive_mapper_graph(pipeline, data, layout='kamada_kawai', layout_dim=2, color_variable=None, node_color_statistic=None, clone_pipeline=True, color_by_columns_dropdown=False, n_sig_figs=3, node_scale=12, plotly_params=None)[source]

Plotting function for interactive Mapper graphs.

Provides functionality to interactively update parameters from the cover and clustering steps defined in pipeline. Nodes are colored according to color_variable and node_color_statistic. By default, the hovertext on each node displays a globally unique ID for the node, the number of data points associated with the node, and the summary statistic which determines its color.

Parameters
  • pipeline (MapperPipeline object) – Mapper pipeline to act on to data.

  • data (array-like of shape (n_samples, n_features)) – Data used to generate the Mapper graph. Can be a pandas dataframe.

  • layout (None, str or callable, optional, default: "kamada-kawai") – Layout algorithm for the graph. Can be any accepted value for the layout parameter in the layout method of igraph.Graph. 1

  • layout_dim (int, default: 2) – The number of dimensions for the layout. Can be 2 or 3.

  • color_variable (object or None, optional, default: None) –

    Specifies a feature of interest to be used, together with node_color_statistic, to determine node colors.

    1. If a numpy array or pandas dataframe, it must have the same length as data.

    2. None is equivalent to passing data.

    3. If an object implementing transform or fit_transform, it is applied to data to generate the feature of interest.

    4. If an index or string, or list of indices/strings, it is equivalent to selecting a column or subset of columns from data.

  • node_color_statistic (callable or None, optional, default: None) – If a callable, node colors will be computed as summary statistics from the feature array Y determined by color_variable – specifically, the color of a node representing the entries of data whose row indices are in I will be node_color_statistic(Y[I]). None is equivalent to passing numpy.mean.

  • color_by_columns_dropdown (bool, optional, default: False) – If True, a dropdown widget is generated which allows the user to color Mapper nodes according to any column in data (still using node_color_statistic) in addition to color_variable.

  • clone_pipeline (bool, optional, default: True) – If True, the input pipeline is cloned before computing the Mapper graph to prevent unexpected side effects from in-place parameter updates.

  • n_sig_figs (int or None, optional, default: 3) – If not None, number of significant figures to which to round node summary statistics. If None, no rounding is performed.

  • node_scale (int or float, optional, default: 12) – Sets the scale factor used to determine the rendered size of the nodes. Increase for larger nodes. Implements a formula in the Plotly documentation.

  • plotly_params (dict or None, optional, default: None) – Custom parameters to configure the plotly figure. Allowed keys are "node_trace", "edge_trace" and "layout", and the corresponding values should be dictionaries containing keyword arguments as would be fed to the update_traces and update_layout methods of plotly.graph_objects.Figure.

Returns

box – A box containing the following widgets: parameters of the clustering algorithm, parameters for the covering scheme, a Mapper graph arising from those parameters, a validation box, and logs.

Return type

ipywidgets.VBox object

References

1

igraph.Graph.layout documentation.