Skip to content

Commit 17faa31

Browse files
committed
ENH: Pass kwargs to plot_surf, checking for cmap first
1 parent 3cf6599 commit 17faa31

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

niworkflows/viz/plots.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ def cifti_surfaces_plot(
975975
surface_type="inflated",
976976
clip_range=(0, None),
977977
output_file=None,
978-
**splt_kwargs,
978+
**kwargs,
979979
):
980980
"""
981981
Plots a CIFTI-2 dense timeseries onto left/right mesh surfaces.
@@ -995,8 +995,8 @@ def cifti_surfaces_plot(
995995
output_file: :obj:`str` or :obj:`None`
996996
Path where the output figure should be saved. If this is not defined,
997997
then the figure will be returned.
998-
splt_kwargs : dict
999-
Keyword arguments for :obj:`surfplot.Plot`
998+
kwargs : dict
999+
Keyword arguments for :obj:`nilearn.plotting.plot_surf`
10001000
10011001
Outputs
10021002
-------
@@ -1049,13 +1049,15 @@ def get_surface_meshes(density, surface_type):
10491049
lh_data = np.clip(lh_data, clip_range[0], clip_range[1], out=lh_data)
10501050
rh_data = np.clip(rh_data, clip_range[0], clip_range[1], out=rh_data)
10511051

1052+
cmap = kwargs.pop('cmap', 'YlOrRd_r')
1053+
10521054
# Build the figure
10531055
lh_mesh, rh_mesh = get_surface_meshes(density, surface_type)
10541056
figure = plt.figure(figsize=plt.figaspect(0.5))
10551057
ax0 = figure.add_subplot(1, 2, 1, projection='3d')
1056-
plot_surf(lh_mesh, lh_data, cmap='YlOrRd_r', axes=ax0)
1058+
plot_surf(lh_mesh, lh_data, cmap=cmap, axes=ax0, **kwargs)
10571059
ax1 = figure.add_subplot(1, 2, 2, projection='3d')
1058-
plot_surf(lh_mesh, lh_data, cmap='YlOrRd_r', axes=ax1)
1060+
plot_surf(lh_mesh, lh_data, cmap=cmap, axes=ax1, **kwargs)
10591061

10601062
if output_file is not None:
10611063
figure.savefig(output_file, bbox_inches="tight")

0 commit comments

Comments
 (0)