dash-cytoscape: A Component Library for Dash aimed at facilitating network visualization in Python, wrapped around Cytoscape.js · Pythie
Dash Cytoscape
A Dash component library for creating interactive and customizable networks in Python, wrapped around Cytoscape.js .
Getting Started in Python
Prerequisites
Make sure that dash and its dependent libraries are correctly installed:
pip install dash
If you want to install the latest versions, check out the Dash docs on installation .
Usage
Install the library using pip:
pip install dash-cytoscape
If you wish to use the CyLeaflet mapping extension, you must install the optional leaflet dependencies:
pip install dash-cytoscape[leaflet]
Create the following example inside an app.py file:
import dash
import dash_cytoscape as cyto
from dash import html
app = dash.Dash(__name__)
app.layout = html.Div([
cyto.Cytoscape(
id='cytoscape',
elements=[
{'data': {'id': 'one', 'label': 'Node 1'}, 'position': {'x': 50, 'y': 50}},
{'data': {'id': 'two', 'label': 'Node 2'}, 'position': {'x': 200, 'y': 200}},
{'data': {'source': 'one', 'target': 'two','label': 'Node 1 to 2'}}
],
layout={'name': 'preset'}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
External layouts You can also add external layouts. Use the cyto.load_extra_layouts() function to get started:
import dash
import dash_cytoscape as cyto
from dash import html
cyto.load_extra_layouts()
app = dash.Dash(__name__)
app.layout = html.Div([
cyto.Cytoscape(...)
])
Calling cyto.load_extra_layouts() also enables generating SVG images.
Getting Started in R
Prerequisites install.packages(c("devtools", "dash"))
Usage Install the library using devtools:
devtools::install_github("plotly/dash-cytoscape")
Create the following example inside an app.R file:
library(dash)
library(dashHtmlComponents)
library(dashCytoscape)
app <- Dash$new()
app$layout(
htmlDiv(
list(
cytoCytoscape(
id = 'cytoscape-two-nodes',
layout = list('name' = 'preset'),
style = list('width' = '100%', 'height' = '400px'),
elements = list(
list('data' = list('id' = 'one', 'label' = 'Node 1'), 'position' = list('x' = 75, 'y' = 75)),
list('data' = list('id' = 'two', 'label' = 'Node 2'), 'position' = list('x' = 200, 'y' = 200)),
list('data' = list('source' = 'one', 'target' = 'two'))
)
)
)
)
)
app$run_server()
Documentation The Dash Cytoscape User Guide contains everything you need to know about the library. It contains useful examples, functioning code, and is fully interactive. You can also use the component reference for a complete and concise specification of the API.
To learn more about the core Dash components and how to use callbacks, view the Dash documentation .
Contributing
Testing
License Dash, Cytoscape.js and Dash Cytoscape are licensed under MIT. Please view LICENSE for more details.
Contact and Support
Acknowledgments Huge thanks to the Cytoscape Consortium and the Cytoscape.js team for their contribution in making such a complete API for creating interactive networks. This library would not have been possible without their massive work!
Gallery
Dynamically expand elements
Interactively update stylesheet
Automatically generate interactive phylogeny trees
Create your own stylesheet
Use event callbacks
Use external layouts
Use export graph as image
Make graph responsive Popularity
Downloads, last 7 days 125.7K+1%
Stars, last 7 days –
Direct dependents 61
All dependents 111 27
Low activity
Maintenance, out of 100
Recent release
last release 866 days ago
Commit activity
no repository data, estimated from releases
Release cadence
0 releases in 12 months
Issues & PRs handled
no data
Contributor spread
no data
OpenSSF Scorecard
not evaluated
Releases
Latest 1.0.2
Released Jul 15, 2024
Releases, 12 months 0
First release Nov 3, 2018 Compatibility
Requires Python >=3.8
Tested on 3.8 · 3.9 · 3.10 · 3.11 · 3.12
License MIT (Permissive) Works well withUse together with dash-cytoscape: extensions, drivers, servers and companion tools.
networkx Pythie’s Index: 88Python package for creating and manipulating graphs and networks 292.4M downloads/mo dash Pythie’s Index: 82A Python framework for building reactive web-apps. Developed by Plotly. 8.3M downloads/mo dash-mantine-components Pythie’s Index: 90Plotly Dash Components based on Mantine 384.3K downloads/mo dash-extensions Pythie’s Index: 48Extensions for Plotly Dash. 328.6K downloads/mo dash-ag-grid Pythie’s Index: 70Dash wrapper around AG Grid, the best interactive data grid for the web. 775.8K downloads/mo