Skip to content

Commit

Permalink
Expose figsize and tight_layout kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
richford committed Dec 22, 2021
1 parent e5ba19b commit 6085843
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions afqinsight/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def plot_tract_profiles(
nrows=None,
ncols=None,
legend_kwargs=None,
figsize=None,
fig_tight_layout_kws=None,
):
"""Plot profiles for each bundle and each metric.
Expand Down Expand Up @@ -128,6 +130,12 @@ def plot_tract_profiles(
legend_kwargs : dict, optional
Keyword arguments to pass to the legend.
figsize : tuple, optional
Figure size for each figure.
fig_tight_layout_kws : dict, optional
Keyword arguments to pass to fig.tight_layout.
Returns
-------
figs : dict
Expand Down Expand Up @@ -217,7 +225,7 @@ def plot_tract_profiles(

ncols = ncols if ncols is not None else 4

fig, axes = plt.subplots(nrows=nrows, ncols=ncols, sharex=True)
fig, axes = plt.subplots(nrows=nrows, ncols=ncols, sharex=True, figsize=figsize)

for tid, df_stat in tqdm(tract_stats.items()):
bundle_id = BUNDLE_MAT_2_PYTHON.get(tid, tid)
Expand Down Expand Up @@ -295,7 +303,10 @@ def plot_tract_profiles(
for legobj in leg.legendHandles:
_ = legobj.set_linewidth(3.0)

fig.tight_layout(h_pad=0.5, w_pad=-0.5)
if fig_tight_layout_kws is None:
fig_tight_layout_kws = dict(h_pad=0.5, w_pad=-0.5)

fig.tight_layout(**fig_tight_layout_kws)

figs[metric] = fig

Expand Down

0 comments on commit 6085843

Please sign in to comment.