-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplot.py
More file actions
95 lines (46 loc) · 1.21 KB
/
plot.py
File metadata and controls
95 lines (46 loc) · 1.21 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#Matplotlib different graph plots
#PIE CHART
import matplotlib.pyplot as plt
lables = 'Python', 'C++', 'Ruby', 'Java'
sizes = [240, 160, 225, 140]
colors = [ 'cyan', 'yellowgreen', 'orange', 'skyblue']
#Exploding the first slice
explode = (0.1, 0, 0, 0)
plt.pie(sizes, explode=explode, labels=lables, colors=colors, autopct='%1.1f%%', shadow=True, startangle=140)
plt.axis('equal')
plt.show()
#BAR PLOT
#scores
x=[100,125,76,90]
#player names
y=["DK","The Wall","Dhoni","Yuvraj"]
plt.ylabel("Score")
plt.xlabel("Player Name")
plt.bar(y,x,label="Overs")
plt.legend()
plt.grid(color='r')
plt.show()
#Line Graph
x = [1,5]
y = [2,7]
x1 = [9,2]
y1 = [3,6]
plt.plot(x,y,label='river',c='skyblue')
plt.plot(x1,y1,label='grass',c='yellowgreen')
plt.xlabel("Time")
plt.ylabel("Speed")
plt.legend()
plt.grid(color='red')
plt.show()
#Scatter Plot
x = [2,2,7,1]
y = [4,8,9,0]
x1 = [3,5,10,9]
y1 = [3,7,12,4]
plt.scatter(x,y,label='river',c='blue',marker='x',s=120)
plt.scatter(x1,y1,label='grass',c='green',s=120)
plt.xlabel("Time")
plt.ylabel("speed")
plt.legend()
plt.grid(color='grey')
plt.show()