Skip to content

Commit

Permalink
Update plotting/utils.py::hist
Browse files Browse the repository at this point in the history
Add argument `save` to optionally save the
histogram.
  • Loading branch information
WeilerP committed Mar 17, 2024
1 parent ffe2cd3 commit 3c4a95d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scvelo/plotting/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@ def hist(
ax=None,
dpi=None,
show=True,
save=None,
**kwargs,
):
"""Plot a histogram.
Expand Down Expand Up @@ -1530,6 +1531,9 @@ def hist(
Figure dpi.
show: `bool`, optional (default: `None`)
Show the plot, do not return axis.
save: `bool` or `str`, optional (default: `None`)
If `True` or a `str`, save the figure. A string is appended to the default filename.
Infer the filetype if ending on {'.pdf', '.png', '.svg'}.
Returns
-------
Expand Down Expand Up @@ -1658,10 +1662,9 @@ def log_fmt(x, pos):
if rcParams["savefig.transparent"]:
ax.patch.set_alpha(0)

if not show:
savefig_or_show(dpi=dpi, save=save, show=show)
if show is False:
return ax
else:
pl.show()


# TODO: Add docstrings
Expand Down

0 comments on commit 3c4a95d

Please sign in to comment.