removed plotters
This commit is contained in:
parent
9935c12eac
commit
f2e08ea22f
|
|
@ -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()
|
||||
Loading…
Reference in New Issue