Skip to content

Commit

Permalink
resolve fig referenced before assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
MUCDK committed Feb 3, 2023
1 parent b171d23 commit f02fca2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/moscot/plotting/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def _sankey(
) -> mpl.figure.Figure:
if ax is None:
fig, ax = plt.subplots(constrained_layout=True, dpi=dpi, figsize=figsize)
else:
fig = ax.figure
if captions is not None and len(captions) != len(transition_matrices):
raise ValueError(f"Expected captions to be of length `{len(transition_matrices)}`, found `{len(captions)}`.")
if colorDict is None:
Expand Down Expand Up @@ -206,6 +208,8 @@ def _heatmap(

if ax is None:
fig, ax = plt.subplots(constrained_layout=True, dpi=dpi, figsize=figsize)
else:
fig = ax.figure
if row_annotation != AggregationMode.CELL:
set_palette(adata=row_adata, key=row_annotation, cont_cmap=cont_cmap)
if col_annotation != AggregationMode.CELL:
Expand Down

0 comments on commit f02fca2

Please sign in to comment.