-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.py
More file actions
33 lines (27 loc) · 875 Bytes
/
graph.py
File metadata and controls
33 lines (27 loc) · 875 Bytes
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
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import sys
class Barplot:
def __init__(self,file,x,y):
self.x = x
self.y = y
self.file = file
def printv(self):
print(self.x," ",self.y," ",self.file)
def plot(self):
data = pd.read_csv(self.file)
fig = plt.figure()
height = data[self.y]
bars = data[self.x]
y_pos = np.arange(len(bars))
plt.bar(y_pos, height)
plt.xlabel(self.x)
plt.ylabel(self.y)
plt.xticks(y_pos, bars, rotation=90)
plt.subplots_adjust(bottom=0.4, top=0.99)
fig.set_size_inches(18.5, 10.5)
fig.savefig('C:/xampp/htdocs/Mini/n.png')
if __name__ =="__main__":
Bar = Barplot(sys.argv[1],sys.argv[2],sys.argv[3])
Bar.plot()