Skip to main content

No project description provided

Project description

Cosmograph Jupyter Widget

This Jupyter widget integrates the @cosmograph/cosmograph library, enabling interactive visualizations of complex graphs directly within Jupyter notebooks. Built using the Anywidget framework.

Installation

To install the Cosmograph Jupyter widget, run the following command:

pip install cosmograph_widget

PyPI Version

Basic Example

Here is a simple example of how to use the Cosmograph Jupyter widget:

from cosmograph_widget import Cosmograph
import pandas as pd

# Define the points of the graph
points = pd.DataFrame([
  { 'index': 0, 'id': '1', 'color': '#88C6FF' },
  { 'index': 1, 'id': '2', 'color': '#FF99D2' },
  { 'index': 2, 'id': '3', 'color': '#E3116C' },
])

# Define the links of the graph
links = pd.DataFrame([
  { 'sourceidx': 0, 'source': '1', 'targetidx': 1, 'target': '2' },
  { 'sourceidx': 0, 'source': '1', 'targetidx': 2, 'target': '3' },
  { 'sourceidx': 1, 'source': '2', 'targetidx': 2, 'target': '3' },
])

# Initialize the Cosmograph widget
cosmo = Cosmograph(points=points, links=links,
   point_id='id',
   point_index='index',
   point_color='color',
   link_source='source',
   link_source_index='sourceidx',
   link_target='target',
   link_target_index='targetidx',
)

# Display the widget
display(cosmo)

Configuration and Customization

The Cosmograph widget offers extensive configuration options to customize its appearance and behavior. For more detailed configuration options, please refer to the @cosmograph/cosmograph documentation.

Development installation

Create a virtual environment and and install cosmograph_widget in editable mode with the optional development dependencies:

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

You then need to install the JavaScript dependencies and run the development server.

npm install
npm run dev

Open example.ipynb in JupyterLab, VS Code, or your favorite editor to start developing. Changes made in js/ will be reflected in the notebook.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cosmograph_widget-0.0.1a1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cosmograph_widget-0.0.1a1-py2.py3-none-any.whl (1.1 MB view details)

Uploaded Python 2Python 3

File details

Details for the file cosmograph_widget-0.0.1a1.tar.gz.

File metadata

  • Download URL: cosmograph_widget-0.0.1a1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for cosmograph_widget-0.0.1a1.tar.gz
Algorithm Hash digest
SHA256 e8369c65bb7b52320a03cccd6c8f672fb2415df82f8f31df9dd6ab05c7ff8ef7
MD5 a82caa01af29f1764b8d1ac28cc5572c
BLAKE2b-256 d8b499e6f631e76afeeb51d350cbe8b50198ef0173ba6c06ee7e0b508cb6769c

See more details on using hashes here.

File details

Details for the file cosmograph_widget-0.0.1a1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cosmograph_widget-0.0.1a1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 38cf5ecd2f90564c99d3edf78fe59f61614057093e97f0ba4497542b920f10ca
MD5 03eff63daf744380d9ad27ebe1fda279
BLAKE2b-256 cf86bec1b699bd2ac2dd35e7deac27d7e421e478c60077f01f448e79c434e899

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page