File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 33import warnings
44from pathlib import Path
55from typing import TYPE_CHECKING
6+ from typing import Any
67
78import numpy as np
89import torch
2425if TYPE_CHECKING :
2526 from matplotlib .colors import BoundaryNorm
2627 from matplotlib .colors import ListedColormap
28+ from matplotlib .figure import Figure
2729
2830
2931def import_mpl_plt ():
@@ -80,10 +82,11 @@ def plot_volume(
8082 reorient = True ,
8183 indices = None ,
8284 rgb = True ,
85+ savefig_kwargs : dict [str , Any ] | None = None ,
8386 ** imshow_kwargs ,
84- ):
87+ ) -> Figure | None :
8588 _ , plt = import_mpl_plt ()
86- fig = None
89+ fig : Figure | None = None
8790 if axes is None :
8891 fig , axes = plt .subplots (1 , 3 , figsize = figsize )
8992
@@ -182,7 +185,9 @@ def plot_volume(
182185 plt .suptitle (title )
183186
184187 if output_path is not None and fig is not None :
185- fig .savefig (output_path )
188+ if savefig_kwargs is None :
189+ savefig_kwargs = {}
190+ fig .savefig (output_path , ** savefig_kwargs )
186191 if show :
187192 plt .show ()
188193 return fig
You can’t perform that action at this time.
0 commit comments