forked from saipraveenpn/rvce-coding-club-ml-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatplotlib.py
More file actions
37 lines (29 loc) · 715 Bytes
/
matplotlib.py
File metadata and controls
37 lines (29 loc) · 715 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
34
35
36
37
from matplotlib import pyplot as plt
plt.plot([1,2,3],[4,5,1])
plt.show()
x = [5,2,7]
y = [2,16,4]
plt.plot(x,y)
plt.show()
#Bargraph
from matplotlib import pyplot as plt
plt.bar([0.25,1.25,2.25],[50,40,70], label="B1",width=.5)
plt.bar([.75,1.75,2.75],[80,20,20], label="B2", color='r',width=.5)
plt.legend()
plt.xlabel('x')
plt.ylabel('y')
plt.title('Test bargraph')
plt.show()
#scatter plot
from matplotlib import pyplot as plt
x = [1,1.5,2,2.5,3,3.5,3.6]
y = [7.5,8,8.5,9,9.5,10,10.5]
x1=[8,8.5,9,9.5,10,10.5,11]
y1=[3,3.5,3.7,4,4.5,5,5.2]
plt.scatter(x,y, label='+-',color='r')
plt.scatter(x1,y1,label='-+',color='b')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Scatter Plot')
plt.legend()
plt.show()