From f2e08ea22f3aff7aa0eb29c984a2f60d410ad98a Mon Sep 17 00:00:00 2001 From: andreapdr Date: Tue, 12 Mar 2024 13:43:21 +0100 Subject: [PATCH] removed plotters --- plotters/distributions.py | 60 --------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 plotters/distributions.py diff --git a/plotters/distributions.py b/plotters/distributions.py deleted file mode 100644 index 8891253..0000000 --- a/plotters/distributions.py +++ /dev/null @@ -1,60 +0,0 @@ -import matplotlib.pyplot as plt -import datetime - - -def plot_distribution( - x, - y, - labels, - title, - figsize=(10, 5), - logscale=False, - notes="", - max_labels=-1, - save=False, - path=None, -): - # sort values and labels accordingly - y, labels = zip(*sorted(zip(y, labels), reverse=True)) - - if max_labels != -1: - x = x[:max_labels] - y = y[:max_labels] - labels = labels[:max_labels] - - plt.figure(figsize=figsize) - plt.bar(x, y) - plt.xticks(x, labels, rotation=90) - - if len(notes) != 0: - _title = f"{title} - {notes}" - if max_labels != -1: - _title += f" - Showing {max_labels} top labels" - - plt.title(_title) - - if logscale: - plt.yscale("symlog") - - plt.tight_layout() - - # plt.show() - if save: - now = datetime.datetime.now() - path = f"{path}/{title}_{now.strftime('%m%d_%H%M')}.png" - plt.savefig(path) - plt.close() - - -def plot_histogram(x, title, figsize=(10, 5), save=False, path=None): - plt.figure(figsize=figsize) - plt.hist(x) - # plt.xticks(x, lables, rotation=90) - plt.yscale("symlog") - plt.title(title) - # plt.show() - if save: - now = datetime.datetime.now() - path = f"{path}/{title}_{now.strftime('%m%d_%H%M')}.png" - plt.savefig(path) - plt.close()