netneurotools.plotting.plot_fsaverage

netneurotools.plotting.plot_fsaverage(data, *, lhannot, rhannot, order='lr', mask=None, noplot=None, subject_id='fsaverage', subjects_dir=None, vmin=None, vmax=None, **kwargs)[source]

Plot data to fsaverage brain using annot as parcellation.

Parameters:
  • data ((N,) array_like) – Data for N parcels as defined in annot

  • lhannot (str) – Filepath to .annot file containing labels to parcels on the left hemisphere. If a full path is not provided the file is assumed to exist inside the subjects_dir/subject/label directory.

  • rhannot (str) – Filepath to .annot file containing labels to parcels on the right hemisphere. If a full path is not provided the file is assumed to exist inside the subjects_dir/subject/label directory.

  • order (str, optional) – Order of the hemispheres in the data vector (either ‘LR’ or ‘RL’). Default: ‘LR’

  • mask ((N,) array_like, optional) – Binary array where entries indicate whether values in data should be masked from plotting (True = mask; False = show). Default: None

  • noplot (list, optional) – List of names in lhannot and rhannot to not plot. It is assumed these are NOT present in data. By default ‘unknown’ and ‘corpuscallosum’ will never be plotted if they are present in the provided annotation files. Default: None

  • subject_id (str, optional) – Subject ID to use; must be present in subjects_dir. Default: ‘fsaverage’

  • subjects_dir (str, optional) – Path to FreeSurfer subject directory. If not set, will inherit from the environmental variable $SUBJECTS_DIR. Default: None

  • vmin (float, optional) – Minimum value for colorbar. If not provided, a robust estimation will be used from values in data. Default: None

  • vmax (float, optional) – Maximum value for colorbar. If not provided, a robust estimation will be used from values in data. Default: None

  • kwargs (key-value pairs) – Provided directly to plot_fsvertex() without modification.

Returns:

brain – Plotted PySurfer brain

Return type:

surfer.Brain

Examples

>>> import numpy as np
>>> from netneurotools.datasets import fetch_cammoun2012,                                            fetch_schaefer2018
>>> from netneurotools.plotting import plot_fsaverage

Plotting with the Cammoun 2012 parcellation we specify order=’RL’ because many of the Lausanne connectomes have data for the right hemisphere before the left hemisphere.

>>> values = np.random.rand(219)
>>> scale = 'scale125'
>>> cammoun = fetch_cammoun2012('fsaverage', verbose=False)[scale]
>>> plot_fsaverage(values, order='RL',
...                lhannot=cammoun.lh, rhannot=cammoun.rh) 

Plotting with the Schaefer 2018 parcellation we can use the default parameter for order:

>>> values = np.random.rand(400)
>>> scale = '400Parcels7Networks'
>>> schaefer = fetch_schaefer2018('fsaverage', verbose=False)[scale]
>>> plot_fsaverage(values,
...                lhannot=schaefer.lh,
...                rhannot=schaefer.rh)