✨ Adds plotting histogram
This commit is contained in:
parent
9d1007d48d
commit
2b0829c78e
@ -35,6 +35,17 @@ def plot_pie(data, labels, title, explode=None):
|
|||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
def plot_hist(data, title, xlabel, ylabel):
|
||||||
|
plt.figure(figsize=(8, 6))
|
||||||
|
plt.hist(data, 25, edgecolor="black")
|
||||||
|
plt.title(title)
|
||||||
|
plt.xlabel(xlabel)
|
||||||
|
plt.ylabel(ylabel)
|
||||||
|
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
grade = dataset[:, 0]
|
grade = dataset[:, 0]
|
||||||
grade_dist = [
|
grade_dist = [
|
||||||
len(grade[grade == 1]) / len(grade),
|
len(grade[grade == 1]) / len(grade),
|
||||||
@ -74,7 +85,9 @@ if graph:
|
|||||||
print("--- GPA ---")
|
print("--- GPA ---")
|
||||||
print("n/a")
|
print("n/a")
|
||||||
print("")
|
print("")
|
||||||
# TODO: graph numerical
|
|
||||||
|
if graph:
|
||||||
|
plot_hist(dataset[:, 2], "Distribúcia piemernu známok", "Piemerná známka", "Počet študentov/tiek")
|
||||||
|
|
||||||
math = dataset[:, 3]
|
math = dataset[:, 3]
|
||||||
math_dist = [
|
math_dist = [
|
||||||
@ -231,4 +244,6 @@ if graph:
|
|||||||
print("--- ABSENCE ---")
|
print("--- ABSENCE ---")
|
||||||
print("n/a")
|
print("n/a")
|
||||||
print("")
|
print("")
|
||||||
# TODO: graph numerical
|
|
||||||
|
if graph:
|
||||||
|
plot_hist(dataset[:, 11], "Distribúcia absencií", "Počet neprítomných hodín", "Počet študentov/tiek")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user