mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-26 01:29:10 +00:00
visualization.py v 1.0.0.001
This commit is contained in:
parent
f36bc9ac13
commit
55e22df665
@ -6,10 +6,12 @@
|
||||
# fancy
|
||||
# setup:
|
||||
|
||||
__version__ = "1.0.0.000"
|
||||
__version__ = "1.0.0.001"
|
||||
|
||||
#changelog should be viewed using print(analysis.__changelog__)
|
||||
__changelog__ = """changelog:
|
||||
1.0.0.001:
|
||||
- added graphhistogram function as a fragment of visualize_pit.py
|
||||
1.0.0.000:
|
||||
- created visualization.py
|
||||
- added graphloss()
|
||||
@ -26,9 +28,31 @@ __all__ = [
|
||||
]
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
def graphloss(losses):
|
||||
|
||||
x = range(0, len(losses))
|
||||
plt.plot(x, losses)
|
||||
plt.show()
|
||||
|
||||
def graphhistogram(data, figsize, sharey = True): # expects library with key as variable and contents as occurances
|
||||
|
||||
fig, ax = plt.subplots(1, len(data), sharey=sharey, figsize=figsize)
|
||||
|
||||
i = 0
|
||||
|
||||
for variable in data:
|
||||
|
||||
ax[i].hist(data[variable])
|
||||
ax[i].invert_xaxis()
|
||||
|
||||
ax[i].set_xlabel('Variable')
|
||||
ax[i].set_ylabel('Frequency')
|
||||
ax[i].set_title(variable)
|
||||
|
||||
plt.yticks(np.arange(len(data[variable])))
|
||||
|
||||
i+=1
|
||||
|
||||
plt.show()
|
Loading…
Reference in New Issue
Block a user