Skip to content

Commit

Permalink
fix 3d axes logic
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffckerr committed Nov 1, 2023
1 parent 73916dd commit aa926ec
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions sciris/sc_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,27 @@ def ax3d(nrows=None, ncols=None, index=None, fig=None, ax=None, returnfig=False,
pass # This is fine, just a different format

# Handle the figure
if fig in [True, False] or (fig is None and figkwargs): # Confusingly, any of these things indicate that we want a new figure
fig = pl.figure(**figkwargs)
elif fig is None: # pragma: no cover
if ax is None:
if not pl.get_fignums():
fig = pl.figure(**figkwargs)
else:
fig = pl.gcf()
if not isinstance(fig, pl.Figure):
if (fig in [True, False] or (fig is None and figkwargs)) and not ax: # Confusingly, any of these things indicate that we want a new figure
fig = pl.figure(**figkwargs)
else:
fig = ax.figure
if ax is None:
if not pl.get_fignums():
fig = pl.figure(**figkwargs)
else:
fig = pl.gcf()
else:
fig = ax.figure

# Handle the figure
if isinstance(fig, pl.Figure):
pass
elif ax is not None:
fig = ax.figure
elif fig == False:
fig = pl.gcf()
else:
fig = pl.figure(**figkwargs)

# Create and initialize the axis
if ax is None:
Expand Down

0 comments on commit aa926ec

Please sign in to comment.