Python object for dash-cytoscape elements
Project description
dash-cytoscape-elements
This is a Python object for Dash Cytoscape Elements.
Features
- Add/Remove/Get/Filter Element(Node/Edge) on Python object.
- Convert Python object from/to Dash Cytoscape format
- Convert Python object from/to json(Cytoscape.js format)
Install
pip install dash-cytoscape-elements
Usage
Example1: Create Elements object & using on Dash Cytoscape
import dash
import dash_cytoscape as cyto
from dash import html
from dash_cytoscape_elements import Elements
elements = Elements()
elements.add(id="one", label="Node 1", x=50, y=50)
elements.add(id="two", label="Node 2", x=200, y=200)
elements.add(source="one", target="two", label="Node 1 to 2")
app = dash.Dash(__name__)
app.layout = html.Div([
cyto.Cytoscape(
id='cytoscape',
elements=elements.to_dash(),
layout={'name': 'preset'}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
Example2: Edit json file of Elements.
from dash_cytoscape_elements import Elements
e = Elements.from_file("elements.json")
e.remove(id="node2")
e.remove(source="node1", target="node2")
with open("elements.json", mode='w') as f:
f.write(e.to_json())
Please see the Documentation for details.
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
Built Distribution
Close
Hashes for dash-cytoscape-elements-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13bfa36d685e1906f5ee87ed0658d6edfbdbd39111fd4a801d767bec6071fca1 |
|
MD5 | cc2b43a0dfc0db1efdd899603f0bef5f |
|
BLAKE2b-256 | 439591583dda41537d52fb64361348d9241eae7a1b66b7683ff8a1be7f197d07 |
Close
Hashes for dash_cytoscape_elements-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af850e6ee43c523ed757d46222a92d8ace0beac3a845b8d71ecccd52294989c6 |
|
MD5 | f88aca11b242c60b1073663b02a28c02 |
|
BLAKE2b-256 | 6ed3bea3fb2a56382e0dc13e6baef25bd1be8a770d18437360bea45322a4ecbf |