@@ -14,7 +14,7 @@ A Dash component library for creating interactive and customizable networks in P
1414
1515## Getting Started
1616
17- ### Prerequisites
17+ ### Prerequisites (Python)
1818
1919Make sure that dash and its dependent libraries are correctly installed:
2020``` commandline
@@ -23,8 +23,13 @@ pip install dash dash-html-components
2323
2424If you want to install the latest versions, check out the [ Dash docs on installation] ( https://dash.plotly.com/installation ) .
2525
26+ ### Prerequisites (R)
2627
27- ### Usage
28+ ``` R
29+ install.packages(c(" devtools" , " dash" ))
30+ ```
31+
32+ ### Usage (Python)
2833
2934Install the library using pip:
3035
@@ -58,6 +63,43 @@ if __name__ == '__main__':
5863
5964![ basic-usage] ( https://raw.githubusercontent.com/plotly/dash-cytoscape/master/demos/images/basic-usage.gif )
6065
66+ ### Usage (R)
67+
68+ Install the library using devtools:
69+
70+ ```
71+ devtools::install_github("plotly/dash-cytoscape")
72+ ```
73+
74+ Create the following example inside an ` app.R ` file:
75+
76+ ``` R
77+ library(dash )
78+ library(dashHtmlComponents )
79+ library(dashCytoscape )
80+
81+ app <- Dash $ new()
82+
83+ app $ layout(
84+ htmlDiv(
85+ list (
86+ cytoCytoscape(
87+ id = ' cytoscape-two-nodes' ,
88+ layout = list (' name' = ' preset' ),
89+ style = list (' width' = ' 100%' , ' height' = ' 400px' ),
90+ elements = list (
91+ list (' data' = list (' id' = ' one' , ' label' = ' Node 1' ), ' position' = list (' x' = 75 , ' y' = 75 )),
92+ list (' data' = list (' id' = ' two' , ' label' = ' Node 2' ), ' position' = list (' x' = 200 , ' y' = 200 )),
93+ list (' data' = list (' source' = ' one' , ' target' = ' two' ))
94+ )
95+ )
96+ )
97+ )
98+ )
99+
100+ app $ run_server()
101+ ```
102+
61103### External layouts
62104
63105You can also add external layouts. Use the ` cyto.load_extra_layouts() ` function to get started:
0 commit comments