mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-10 06:54:44 +00:00
visualization.py v 1.0.0.001
This commit is contained in:
parent
64ae1b7026
commit
db8fbbf068
@ -6,10 +6,12 @@
|
|||||||
# fancy
|
# fancy
|
||||||
# setup:
|
# setup:
|
||||||
|
|
||||||
__version__ = "1.0.0.000"
|
__version__ = "1.0.0.001"
|
||||||
|
|
||||||
#changelog should be viewed using print(analysis.__changelog__)
|
#changelog should be viewed using print(analysis.__changelog__)
|
||||||
__changelog__ = """changelog:
|
__changelog__ = """changelog:
|
||||||
|
1.0.0.001:
|
||||||
|
- added graphhistogram function as a fragment of visualize_pit.py
|
||||||
1.0.0.000:
|
1.0.0.000:
|
||||||
- created visualization.py
|
- created visualization.py
|
||||||
- added graphloss()
|
- added graphloss()
|
||||||
@ -26,9 +28,31 @@ __all__ = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
def graphloss(losses):
|
def graphloss(losses):
|
||||||
|
|
||||||
x = range(0, len(losses))
|
x = range(0, len(losses))
|
||||||
plt.plot(x, losses)
|
plt.plot(x, losses)
|
||||||
plt.show()
|
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