-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
930 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
# %% [markdown] | ||
""" | ||
# Node properties: size | ||
Netplotbrain allows for specifying different figure properties by only specifyign the column name. | ||
Below we demonstrate how node_size can change based on different columns in the nodes dataframe. | ||
The key lines of code here are when: | ||
`node_size='centrality_measure1'` | ||
and | ||
`node_size='centrality_measure2'` | ||
These columns could be called anything such as "module_degree_zscore" or "efficiency" | ||
""" | ||
# | ||
# # Node properties: size | ||
# | ||
# Netplotbrain allows for specifying different figure properties by only specifyign the column name. | ||
# | ||
# Below we demonstrate how node_size can change based on different columns in the nodes dataframe. | ||
# | ||
# The key lines of code here are when: | ||
# | ||
# `node_size='centrality_measure1'` | ||
# | ||
# and | ||
# | ||
# `node_size='centrality_measure2'` | ||
# | ||
# These columns could be called anything such as "module_degree_zscore" or "efficiency" |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# # Specifying node colormaps | ||
# | ||
# [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/node_cmap.ipynb) | ||
# | ||
# See [example about colors for different way the color columns in the dataframe can be specified](https://www.netplotbrain.org/gallery/specifying_node_color/) | ||
# | ||
# There are two different ways to specify colormaps. This holds for both nodes (node_cmap) edges (edge_cmap) | ||
# | ||
# The first way entails that you specify a matplotlib colormap (e.g. Set1, Inferno, (see options [here](https://matplotlib.org/stable/tutorials/colors/colormaps.html)) | ||
# | ||
# The second way is to provide a list of matplotlib colors to create your own colormap (see named color options [here](https://matplotlib.org/stable/gallery/color/named_colors.html)) | ||
# | ||
# This notebook will shows an example of each of these. We will use 100 ROIs from the Schaefer atlas and color the 7 Yeo networks | ||
|
||
# Import necessary packages | ||
import netplotbrain | ||
import pandas as pd | ||
import templateflow.api as tf | ||
|
||
# Load templateflow information about the Schaefer atlas | ||
atlasinfo = tf.get(template='MNI152NLin2009cAsym', | ||
atlas='Schaefer2018', | ||
desc='100Parcels7Networks', | ||
extension='.tsv') | ||
atlas_df = pd.read_csv(str(atlasinfo), sep='\t') | ||
atlas_df.head() | ||
|
||
# Create a column called "network" by extracting the relevant information from the column "name" | ||
atlas_df['network'] = list(map(lambda x: x.split('_')[2], atlas_df.name.values)) | ||
atlas_df.head() | ||
|
||
# Define the TemplateFlow parcels that we want to plot | ||
nodes = {'template': 'MNI152NLin2009cAsym', | ||
'atlas': 'Schaefer2018', | ||
'desc': '100Parcels7Networks', | ||
'resolution': 1} | ||
|
||
# Plot with a the Set2 colormap | ||
netplotbrain.plot(nodes=nodes, | ||
node_type='parcels', | ||
nodes_df=atlas_df, | ||
node_color='network', | ||
node_cmap='Set2') | ||
|
||
# Create custom colormap | ||
node_cmap = ['blue', 'red', 'green', 'black', 'purple', 'yellow', 'orange'] | ||
|
||
# Plot with a the custom colormap | ||
netplotbrain.plot(nodes=nodes, | ||
node_type='parcels', | ||
nodes_df=atlas_df, | ||
node_color='network', | ||
node_cmap=node_cmap) |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.