pynets.plotting package¶
Submodules¶
pynets.plotting.adjacency module¶
Created on Tue Nov 7 10:40:07 2017 Copyright (C) 2017
- pynets.plotting.adjacency.plot_community_conn_mat(conn_matrix, labels, out_path_fig_comm, community_aff, cmap, dpi_resolution=300)[source]¶
Plot a community-parcellated connectivity matrix.
- Parameters
- conn_matrixarray
NxN matrix.
- labelslist
List of string labels corresponding to ROI nodes.
- out_path_fig_commstr
File path to save the community-parcellated connectivity matrix image as a .png figure.
- community_affarray
Community-affiliation vector.
- pynets.plotting.adjacency.plot_conn_mat(conn_matrix, labels, out_path_fig, cmap, binarized=False, dpi_resolution=300)[source]¶
Plot a connectivity matrix.
- Parameters
- conn_matrixarray
NxN matrix.
- labelslist
List of string labels corresponding to ROI nodes.
- out_path_figstr
File path to save the connectivity matrix image as a .png figure.
- pynets.plotting.adjacency.plot_conn_mat_func(conn_matrix, conn_model, atlas, dir_path, ID, subnet, labels, roi, thr, node_radius, smooth, hpass, signal)[source]¶
API for selecting among various functional connectivity matrix plotting approaches.
- Parameters
- conn_matrixarray
NxN matrix.
- conn_modelstr
Connectivity estimation model (e.g. corr for correlation, cov for covariance, sps for precision covariance, partcorr for partial correlation). sps type is used by default.
- atlasstr
Name of atlas parcellation used.
- dir_pathstr
Path to directory containing subject derivative data for given run.
- IDstr
A subject id or other unique identifier.
- subnetstr
Resting-state subnet based on Yeo-7 and Yeo-17 naming (e.g. ‘Default’) used to filter nodes in the study of brain subgraphs.
- labelslist
List of string labels corresponding to ROI nodes.
- roistr
File path to binarized/boolean region-of-interest Nifti1Image file.
- thrfloat
A value, between 0 and 1, to threshold the graph using any variety of methods triggered through other options.
- node_radiusint
Spherical centroid node size in the case that coordinate-based centroids are used as ROI’s.
- smoothint
Smoothing width (mm fwhm) to apply to time-series when extracting signal from ROI’s.
- hpassbool
High-pass filter values (Hz) to apply to node-extracted time-series.
- signalstr
The name of a valid function used to reduce the time-series region extraction.
- pynets.plotting.adjacency.plot_conn_mat_struct(conn_matrix, conn_model, atlas, dir_path, ID, subnet, labels, roi, thr, node_radius, track_type, traversal, min_length, error_margin)[source]¶
API for selecting among various structural connectivity matrix plotting approaches.
- Parameters
- conn_matrixarray
NxN matrix.
- conn_modelstr
Connectivity estimation model (e.g. corr for correlation, cov for covariance, sps for precision covariance, partcorr for partial correlation). sps type is used by default.
- atlasstr
Name of atlas parcellation used.
- dir_pathstr
Path to directory containing subject derivative data for given run.
- IDstr
A subject id or other unique identifier.
- subnetstr
Resting-state subnet based on Yeo-7 and Yeo-17 naming (e.g. ‘Default’) used to filter nodes in the study of brain subgraphs.
- labelslist
List of string labels corresponding to ROI nodes.
- roistr
File path to binarized/boolean region-of-interest Nifti1Image file.
- thrfloat
A value, between 0 and 1, to threshold the graph using any variety of methods triggered through other options.
- node_radiusint
Spherical centroid node size in the case that coordinate-based centroids are used as ROI’s.
- track_typestr
Tracking algorithm used (e.g. ‘local’ or ‘particle’).
- traversalstr
The statistical approach to tracking. Options are: det (deterministic), closest (clos), boot (bootstrapped), and prob (probabilistic).
- min_lengthint
Minimum fiber length threshold in mm to restrict tracking.
pynets.plotting.brain module¶
Created on Tue Nov 7 10:40:07 2017 Copyright (C) 2017
- pynets.plotting.brain.create_gb_palette(mat, edge_cmap, coords, labels, node_radius='auto', node_cmap=None, prune=True, centrality_type='eig', max_node_radius=None, max_edge_size=2, node_aff_mat=None)[source]¶
Create connectome color palette based on graph topography.
- Parameters
- matarray
NxN matrix.
- edge_cmap: colormap
colormap used for representing the weight of the edges.
- coordslist
List of (x, y, z) tuples corresponding to an a-priori defined set (e.g. a coordinate atlas).
- labelslist
List of string labels corresponding to ROI nodes.
- node_radiusint
Spherical centroid node size in the case that coordinate-based centroids are used as ROI’s.
- node_radius: scalar or array_like
size(s) of the nodes in points^2.
- node_cmap: colormap
colormap used for representing the community assignment of the nodes.
- pynets.plotting.brain.plot_all_func(conn_matrix, conn_model, atlas, dir_path, ID, subnet, labels, roi, coords, thr, node_radius, edge_threshold, smooth, prune, parcellation, norm, binary, hpass, signal, edge_color_override=False)[source]¶
Plot adjacency matrix, connectogram, and glass brain for functional connectome.
- Parameters
- conn_matrixarray
NxN matrix.
- conn_modelstr
Connectivity estimation model (e.g. corr for correlation, cov for covariance, sps for precision covariance, partcorr for partial correlation). sps type is used by default.
- atlasstr
Name of atlas parcellation used.
- dir_pathstr
Path to directory containing subject derivative data for given run.
- IDstr
A subject id or other unique identifier.
- subnetstr
Resting-state subnet based on Yeo-7 and Yeo-17 naming (e.g. ‘Default’) used to filter nodes in the study of brain subgraphs.
- labelslist
List of string labels corresponding to ROI nodes.
- roistr
File path to binarized/boolean region-of-interest Nifti1Image file.
- coordslist
List of (x, y, z) tuples corresponding to an a-priori defined set (e.g. a coordinate atlas).
- thrfloat
A value, between 0 and 1, to threshold the graph using any variety of methods triggered through other options.
- node_radiusint
Spherical centroid node size in the case that coordinate-based centroids are used as ROI’s.
- edge_thresholdfloat
The actual value, between 0 and 1, that the graph was thresholded (can differ from thr if target was not successfully obtained.
- smoothint
Smoothing width (mm fwhm) to apply to time-series when extracting signal from ROI’s.
- prunebool
Indicates whether to prune final graph of disconnected nodes/isolates.
- parcellationstr
File path to atlas parcellation Nifti1Image.
- normint
Indicates method of normalizing resulting graph.
- binarybool
Indicates whether to binarize resulting graph edges to form an unweighted graph.
- hpassbool
High-pass filter values (Hz) to apply to node-extracted time-series.
- signalstr
The name of a valid function used to reduce the time-series region extraction.
- edge_color_overridebool
Switch that enables random sequential colormap selection for edges.
- pynets.plotting.brain.plot_all_struct(conn_matrix, conn_model, atlas, dir_path, ID, subnet, labels, roi, coords, thr, node_radius, edge_threshold, prune, parcellation, norm, binary, track_type, traversal, min_length, error_margin)[source]¶
Plot adjacency matrix, connectogram, and glass brain for functional connectome.
- Parameters
- conn_matrixarray
NxN matrix.
- conn_modelstr
Connectivity estimation model (e.g. corr for correlation, cov for covariance, sps for precision covariance, partcorr for partial correlation). sps type is used by default.
- atlasstr
Name of atlas parcellation used.
- dir_pathstr
Path to directory containing subject derivative data for given run.
- IDstr
A subject id or other unique identifier.
- subnetstr
Resting-state subnet based on Yeo-7 and Yeo-17 naming (e.g. ‘Default’) used to filter nodes in the study of brain subgraphs.
- labelslist
List of string labels corresponding to ROI nodes.
- roistr
File path to binarized/boolean region-of-interest Nifti1Image file.
- coordslist
List of (x, y, z) tuples corresponding to an a-priori defined set (e.g. a coordinate atlas).
- thrfloat
A value, between 0 and 1, to threshold the graph using any variety of methods triggered through other options.
- node_radiusint
Spherical centroid node size in the case that coordinate-based centroids are used as ROI’s.
- edge_thresholdfloat
The actual value, between 0 and 1, that the graph was thresholded (can differ from thr if target was not successfully obtained.
- prunebool
Indicates whether to prune final graph of disconnected nodes/isolates.
- parcellationstr
File path to atlas parcellation Nifti1Image.
- normint
Indicates method of normalizing resulting graph.
- binarybool
Indicates whether to binarize resulting graph edges to form an unweighted graph.
- track_typestr
Tracking algorithm used (e.g. ‘local’ or ‘particle’).
- traversalstr
The statistical approach to tracking. Options are: det (deterministic), closest (clos), boot (bootstrapped), and prob (probabilistic).
- min_lengthint
Minimum fiber length threshold in mm to restrict tracking.
- pynets.plotting.brain.plot_all_struct_func(mG_paths, namer_dir, modality_paths)[source]¶
Plot adjacency matrix and glass brain for structural-functional multiplex connectome.
- Parameters
- mG_pathstuple
A tuple of two gpickle file paths containing a NetworkX OrderedMultiGraph object and a MultilayerGraph object (See https://github.com/nkoub/multinetx).
- namer_dirstr
Path to output directory for multiplex data.
- modality_pathstuple
A tuple of filepath strings to the raw structural and raw functional connectome graph files (.npy).
- pynets.plotting.brain.plot_graph_measure_hists(csv_all_metrics)[source]¶
Plot histograms for each graph theoretical measure for a given subject.
- Parameters
- csv_all_metricsstr
CSV file of concatenated graph measures across ensemble.
- pynets.plotting.brain.plot_network_clusters(graph, communities, out_path, figsize=(8, 8), node_radius=50, plot_overlaps=False, plot_labels=False)[source]¶
Plot a graph with node color coding for communities.
- Parameters
- graphNetworkX graph
- communitiesarray
Community affiliation vector
- out_pathstr
Path to save figure.
- figsizeTuple of integers
The figure size; it is a pair of float, default (8, 8).
- node_radius: int
Default 50.
- plot_overlapsbool
Flag to control if multiple algorithms memberships are plotted. Default is False.
- plot_labelsbool
Flag to control if node labels are plotted. Default is False.
- pynets.plotting.brain.plot_timeseries(time_series, subnet, ID, dir_path, atlas, labels)[source]¶
Plot time-series.
- Parameters
- time-seriesarray
2D m x n array consisting of the time-series signal for each ROI node where m = number of scans and n = number of ROI’s.
- subnetstr
Resting-state subnet based on Yeo-7 and Yeo-17 naming (e.g. ‘Default’) used to filter nodes in the study of brain subgraphs.
- IDstr
A subject id or other unique identifier.
- dir_pathstr
Path to directory containing subject derivative data for given run.
- atlasstr
Name of atlas parcellation used.
- labelslist
List of string labels corresponding to ROI nodes.