kmapper.draw_matplotlib

kmapper.draw_matplotlib(g, ax=None, fig=None, layout='kk')[source]

Draw the graph using NetworkX drawing functionality.

Parameters:
  • g (graph object returned by map) – The Mapper graph as constructed by KeplerMapper.map
  • ax (matplotlib Axes object) – A matplotlib axes object to plot graph on. If none, then use plt.gca()
  • fig (matplotlib Figure object) – A matplotlib Figure object to plot graph on. If none, then use plt.figure()
  • layout (string) –

    Key for which of NetworkX’s layout functions. Key options implemented are:

    >>> "kk": nx.kamada_kawai_layout,
    >>> "spring": nx.spring_layout,
    >>> "bi": nx.bipartite_layout,
    >>> "circ": nx.circular_layout,
    >>> "spect": nx.spectral_layout
    
Returns:

nodes (nx node set object list) – List of nodes constructed with Networkx draw_networkx_nodes. This can be used to further customize node attributes.