Skip to content

Commit 38add68

Browse files
authored
Merge pull request #90 from VinceBaz/master
[ENH] Added data_kws argument to plot_fsaverage
2 parents 43ae03a + a424396 commit 38add68

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

netneurotools/plotting.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def plot_fsaverage(data, *, lhannot, rhannot, order='LR', surf='pial',
327327
colormap='viridis', colorbar=True, alpha=0.8,
328328
label_fmt='%.2f', num_labels=3, size_per_view=500,
329329
subject_id='fsaverage', subjects_dir=None,
330-
noplot=None, **kwargs):
330+
noplot=None, data_kws=None, **kwargs):
331331
"""
332332
Plots `data` to fsaverage brain using `annot` as parcellation
333333
@@ -384,6 +384,8 @@ def plot_fsaverage(data, *, lhannot, rhannot, order='LR', surf='pial',
384384
these are NOT present in `data`. By default 'unknown' and
385385
'corpuscallosum' will never be plotted if they are present in the
386386
provided annotation files. Default: None
387+
data_kws : dict, optional
388+
Keyword arguments for Brain.add_data()
387389
388390
Returns
389391
-------
@@ -416,6 +418,10 @@ def plot_fsaverage(data, *, lhannot, rhannot, order='LR', surf='pial',
416418
# cast data to float (required for NaNs)
417419
data = np.asarray(data, dtype='float')
418420

421+
# handle data_kws if None
422+
if data_kws is None:
423+
data_kws = {}
424+
419425
if order not in ['LR', 'RL']:
420426
raise ValueError('order must be either \'LR\' or \'RL\'')
421427

@@ -490,7 +496,8 @@ def plot_fsaverage(data, *, lhannot, rhannot, order='LR', surf='pial',
490496
# finally, add data to this hemisphere!
491497
brain.add_data(vtx_data, vmin, vmax, hemi=hemi, mid=center,
492498
thresh=thresh + 0.5, alpha=1.0, remove_existing=False,
493-
colormap=colormap, colorbar=colorbar, verbose=False)
499+
colormap=colormap, colorbar=colorbar, verbose=False,
500+
**data_kws)
494501

495502
if alpha != 1.0:
496503
surf = brain.data_dict[hemi]['surfaces']

0 commit comments

Comments
 (0)