-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotting.py
More file actions
43 lines (33 loc) · 1.01 KB
/
plotting.py
File metadata and controls
43 lines (33 loc) · 1.01 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
#importing matplotlib module
from matplotlib import pyplot as plt
###------------------------------------ LINE PLOTTING-------------------------------- ###
# x-axis values
#[x1,x2,x3,x4]
x=[5,2,9,4,7,10,12,20,8,14]
# y-axis values
#[y1,y2,y3,y4]
y=[10,5,8,4,2,8,11,15,12,16]
#Function to plot
plt.plot(x,y)
#function to show the plot
plt.show()
###----------------------------------BAR PLOTTING----------------------------------- ###
# x-axis values
#[x1,x2,x3,x4]
x= [5,2,9,4,7,10,12,20,8,14]
# y-axis values
#[y1,y2,y3,y4]
y= [10,5,8,4,2,8,11,15,12,16]
#Function to plot
plt.bar(x,y)
#function to show the plot
plt.show()
### --------------------------------HISTOGRAM PLOTTING------------------------------- ###
y=[13,1,2,6,4,15,25,9,6,5,12]
plt.hist(y)
plt.show()
### --------------------------------SCATTER PLOTTING-----------------------------------###
plt.plot([1,2,3,4,5,6,7,8,9,10], [1,4,9,16,25,36,49,64,81,100], 'ro')
#ro to make red circles
plt.axis([0,11,0,120])
plt.show()