Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Interactive network visualization in Python and Dash, powered by Cytoscape.js

License

NotificationsYou must be signed in to change notification settings

plotly/dash-cytoscape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maintained by Plotly

CircleCI

A Dash component library for creating interactive and customizable networks in Python, wrapped aroundCytoscape.js.

usage-stylesheet-demo

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 theDash docs on installation.

Usage

Install the library usingpip:

pip install dash-cytoscape

If you wish to use the CyLeaflet mapping extension, you must install the optionalleaflet dependencies:

pip install dash-cytoscape[leaflet]

Create the following example inside anapp.py file:

importdashimportdash_cytoscapeascytofromdashimporthtmlapp=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(debug=True)

basic-usage

External layouts

You can also add external layouts. Use thecyto.load_extra_layouts() function to get started:

importdashimportdash_cytoscapeascytofromdashimporthtmlcyto.load_extra_layouts()app=dash.Dash(__name__)app.layout=html.Div([cyto.Cytoscape(...)])

Callingcyto.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 anapp.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

TheDash 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 thecomponent reference for a complete and concise specification of the API.

To learn more about the core Dash components and how to use callbacks, view theDash documentation.

For supplementary information about the underlying Javascript API, view theCytoscape.js documentation.

Contributing

Make sure that you have read and understood ourcode of conduct, then head over toCONTRIBUTING to get started.

Testing

Instructions on how to runtests are given inCONTRIBUTING.md.

License

Dash, Cytoscape.js and Dash Cytoscape are licensed under MIT. Please viewLICENSE for more details.

Contact and Support

Seehttps://plotly.com/dash/support for ways to get in touch.

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!

The Pull Request and Issue Templates were inspired from thescikit-learn project.

Gallery

Dynamically expand elements

Code |DemoView usage-elements on Github

Interactively update stylesheet

Code |DemoView usage-stylesheet on Github

Automatically generate interactive phylogeny trees

Code |DemoView usage-phylogeny on Github

Create your own stylesheet

Code |DemoView usage-advanced on Github

Use event callbacks

Code |DemoView usage-events on Github

Use external layouts

CodeView usage-elements-extra on Github

Use export graph as image

CodeView usage-image-export on Github

Make graph responsive

CodeView usage-responsive-graph on Github

For an extended gallery, visit thedemos' readme.


[8]ページ先頭

©2009-2025 Movatter.jp