Skip to content
Snippets Groups Projects
Commit 38bc3f7b authored by Andrey Aristov's avatar Andrey Aristov
Browse files

savefig

parent 3420ac29
No related branches found
No related tags found
1 merge request!5fix testing and stuff
...@@ -5,7 +5,7 @@ import numpy as np ...@@ -5,7 +5,7 @@ import numpy as np
def fit(numbers:np.ndarray, max_value=None, xlabel='Initial number of cells', def fit(numbers:np.ndarray, max_value=None, xlabel='Initial number of cells',
title='', plot=True): title='', plot=True, save_fig_path=None):
if max_value is None: if max_value is None:
max_value = numbers.max() max_value = numbers.max()
bins = np.arange(max_value + 1) - .5 bins = np.arange(max_value + 1) - .5
...@@ -19,5 +19,11 @@ def fit(numbers:np.ndarray, max_value=None, xlabel='Initial number of cells', ...@@ -19,5 +19,11 @@ def fit(numbers:np.ndarray, max_value=None, xlabel='Initial number of cells',
plt.xlabel(xlabel) plt.xlabel(xlabel)
plt.title(title) plt.title(title)
plt.legend() plt.legend()
if save_fig_path is not None:
try:
plt.savefig(save_fig_path)
print(f'Save histogram {save_fig_path}')
except Exception as e:
print('saving histogram failed', e.args)
plt.show() plt.show()
return l return l
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment