Simple plot¶
Open interactive notebook in Binder Below, we load some test data and only specify the template space we would like it plotted in.
In [1]:
Copied!
# Load imports
import netplotbrain
import pandas as pd
# Load imports
import netplotbrain
import pandas as pd
In [2]:
Copied!
#Path to node and edge example data on netplotbrain
nodepath = 'https://raw.githubusercontent.com/wiheto/netplotbrain/main/examples/example_nodes.tsv'
edgepath = 'https://raw.githubusercontent.com/wiheto/netplotbrain/main/examples/example_edges.tsv'
#Path to node and edge example data on netplotbrain
nodepath = 'https://raw.githubusercontent.com/wiheto/netplotbrain/main/examples/example_nodes.tsv'
edgepath = 'https://raw.githubusercontent.com/wiheto/netplotbrain/main/examples/example_edges.tsv'
In [3]:
Copied!
#Example node and edges dataframes included with package
nodes = pd.read_csv(nodepath, sep='\t', index_col=0)
# peak at first lines of nodes dataframe
nodes.head()
#Example node and edges dataframes included with package
nodes = pd.read_csv(nodepath, sep='\t', index_col=0)
# peak at first lines of nodes dataframe
nodes.head()
Out[3]:
x | y | z | centrality_measure1 | centrality_measure2 | community | |
---|---|---|---|---|---|---|
0 | -50 | -55 | -30 | 0.5 | 0.7 | Default |
1 | -50 | 15 | -30 | 0.2 | 0.7 | Default |
2 | -25 | -90 | -30 | 0.3 | 0.6 | Salience |
3 | -25 | -20 | -30 | 0.3 | 0.9 | Default |
4 | -25 | 15 | -30 | 0.3 | 0.5 | Salience |
In [4]:
Copied!
edges = pd.read_csv(edgepath, sep='\t', index_col=0)
# peak at first lines of edges dataframe
edges.head()
edges = pd.read_csv(edgepath, sep='\t', index_col=0)
# peak at first lines of edges dataframe
edges.head()
Out[4]:
i | j | weight | |
---|---|---|---|
0 | 4 | 29 | 0.1 |
1 | 8 | 21 | 0.3 |
2 | 9 | 20 | 0.3 |
3 | 16 | 29 | 0.1 |
4 | 0 | 2 | 0.3 |
In [5]:
Copied!
netplotbrain.plot(template='MNI152NLin2009cAsym',
nodes=nodes,
edges=edges)
netplotbrain.plot(template='MNI152NLin2009cAsym',
nodes=nodes,
edges=edges)
Out[5]:
(<Figure size 216x216 with 1 Axes>, [<Axes3D: title={'center': 'Left'}>])