-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotAna.py
53 lines (35 loc) · 1.37 KB
/
plotAna.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
#imports
#************************************************************************************
import sys
import matplotlib.pyplot as plt
import scipy as si
import numpy as np
import scipy.stats as sit
import math
#************************************************************************************
#Prompt for file
#************************************************************************************
if len(sys.argv) != 2:
fName = raw_input("filename: ")
else:
fName = sys.argv[1]
#************************************************************************************
#Read and organize imported file into dictionary
#************************************************************************************
portFreakMap = {}
with open(fName, 'r') as f:
for line in f:
line = line.split(',')
portFreakMap[int(line[0])] = int(line[1])
#pfm = (portFreakMap[int(line[0])]=int(line[1]))
pfm = portFreakMap
#************************************************************************************
#Plot
#************************************************************************************
plt.grid(True)
plt.title('Frequency of {0}:'.format(fName))
plt.bar(range(len(pfm)), pfm.values(), align='center')
plt.xticks(range(len(pfm)), pfm.keys())
plt.show()
#************************************************************************************