Widget in Jupyter NotebookGet started

Get started

The Cosmograph widget allows users to visualize complex data relationships directly in Jupyter notebooks, enhancing data analysis capabilities. Built on top of Anywidget, it integrates seamlessly within Jupyter environments, providing an interactive graphing experience.

Installation

PyPI Version

To install the Cosmograph widget, run:

pip install cosmograph_widget

Quick Start

After installation, you can import and use the widget in any Python-based notebook environment:

from cosmograph import cosmo
 
points = pd.DataFrame({
    'id': [1, 2, 3, 4, 5],
    'label': ['Node A', 'Node B', 'Node C', 'Node D', 'Node E'],
    'value': [10, 20, 15, 25, 30]
})
 
links = pd.DataFrame({
    'source': [1, 2, 3, 1, 2],
    'target': [2, 3, 4, 5, 4],
    'value': [1.0, 2.0, 1.5, 0.5, 1.8]
})
 
cosmo(
  points=points,
  links=links,
  point_id_by='id',
  link_source_by='source',
  link_target_by='target',
 
  point_include_columns=['value'],
  point_label_by='label',
  link_include_columns=['value'],
)

The widget will render an interactive graph visualization inline, allowing you to explore and manipulate your data directly.

Examples