kmapper.jupyter

Functions

display([path_html])

Displays a html file inside a Jupyter Notebook output cell.

kmapper.jupyter.display(path_html='mapper_visualization_output.html')[source]

Displays a html file inside a Jupyter Notebook output cell.

Note

Must run KeplerMapper.visualize first to generate html. This function will then render that output from a file saved to disk.

Note

Thanks to smartinsightsfromdata for the github issue 10 that suggested this method.

Parameters:

path_html (str) – Path to html. Use file name for file inside current working directory. Use file:// browser url-format for path to local file. Use https:// urls for externally hosted resources.

Examples

import numpy as np
import kmapper as km
from kmapper.jupyter import display

data = np.random.random((2000, 2))
mapper = km.KeplerMapper()
lens = km.project(data)
graph = km.map(lens, data)
_ = km.visualize(graph, path_html="filename.html")

display("filename.html")

The default filename is the same default as the .visualize method, so using both without arguments will show the last constructed graph:

>>> _ = km.visualize(graph)
>>> display()