From 0dee2e5466a0cae5dd018c742d2f29dcbb92142e Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Fri, 15 Sep 2023 16:19:58 +0200 Subject: [PATCH] Do not modify argument x of `plot_distr_funct` Do not modify dummy argument x of `plot_distr_funct`. --- Inst_eddies/Analysis/distribution_function.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Inst_eddies/Analysis/distribution_function.py b/Inst_eddies/Analysis/distribution_function.py index 610891fc..4d3a4e77 100755 --- a/Inst_eddies/Analysis/distribution_function.py +++ b/Inst_eddies/Analysis/distribution_function.py @@ -9,14 +9,14 @@ from os import path def plot_distr_funct(x, label = None, ax = None): """Sort and plot distribution function. x should be a Numpy array.""" - x.sort() + x_sorted = np.sort(x) nx = np.size(x) if nx != 0: if ax is None: fig, ax = plt.subplots() - ax.plot(x, (1 + np.arange(nx)) / nx, label = label) - print("minimum value:", x[0]) - print("maximum value:", x[-1]) + ax.plot(x_sorted, (1 + np.arange(nx)) / nx, label = label) + print("minimum value:", x_sorted[0]) + print("maximum value:", x_sorted[- 1]) print("number of values:", nx, "\n") -- GitLab