Skip to content
Snippets Groups Projects
Commit ac00fff8 authored by Peter Swain's avatar Peter Swain
Browse files

change(bud_to_bud_plot): creating figure optional

parent baf80431
No related branches found
No related tags found
No related merge requests found
......@@ -538,6 +538,7 @@ def bud_to_bud_plot(
df=None,
title=None,
filter_func=None,
show_figure=True,
):
"""
Plot the median and percentiles of a signal between consecutive buddings.
......@@ -571,6 +572,10 @@ def bud_to_bud_plot(
Title for plot.
filter_func: fn
Filter to apply to each time series.
show_figure: boolean
If False, only plot is called and no figure created so multiple
data sets can be shown on the same plot by calling bud_to_bud_plot
multiple times.
Example
-------
......@@ -624,7 +629,8 @@ def bud_to_bud_plot(
right=np.nan,
)
# plot median and percentiles
plt.figure()
if show_figure:
plt.figure()
plt.plot(ntbins, np.nanmedian(new_signal, axis=0), f"{colour}.-")
for lower, upper in zip([45, 40, 35], [55, 60, 65]):
plt.fill_between(
......@@ -636,11 +642,12 @@ def bud_to_bud_plot(
)
plt.xlabel("position between budding events")
plt.ylabel(signal.replace("_", " "))
plt.grid()
if title is None:
plt.title(f"{dl.dataname}: t={tpt}")
else:
plt.title(title)
plt.show(block=False)
if show_figure:
plt.grid()
if title is None:
plt.title(f"{dl.dataname}: t={tpt}")
else:
plt.title(title)
plt.show(block=False)
if return_signal:
return new_signal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment