-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmtpt.py
More file actions
308 lines (211 loc) · 7.06 KB
/
Copy pathmtpt.py
File metadata and controls
308 lines (211 loc) · 7.06 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
#first program with the help of matplotlib.
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
#python-m pip install --upgrade pip
#How can we create a line plot
'''x= np.arange(1,11)
y=2*x
print(x)
print(y)
plt.plot(x,y)
plt.show()'''
#how can we add title and labels
'''x= np.arange(1,11)
y= 2*x
print(x)
print(y)
plt.plot(x,y)
plt.title("SimpleLine Plot")
plt.xlabel("Data on x-axis")
plt.ylabel("Data on y-axis")
plt.show() '''
#how can we change the colour, linestyle and linewidth
'''x= np.arange(1,11)
y= 2*x
print(x)
print(y)
plt.plot(x,y,color="blue",linestyle=":",linewidth=5)
plt.title("SimpleLine Plot")
plt.xlabel("Data on x-axis")
plt.ylabel("Data on y-axis")
plt.show() '''
'''x= np.arange(1,11)
y1= 2*x
y2=3*x
print(y1)
print(y2)
plt.plot(x,y1,color="blue",linestyle=":",linewidth=5)
plt.plot(x,y2,color="orange",linestyle="-.",linewidth=5)
plt.title("Two Lines in one plot")
plt.xlabel("range")
plt.ylabel("two Lines")
plt.grid(True)
plt.show() '''
#How can we Create SUB PLOTS ROW WISE
#IF I WANT TO STACCK BOTH SUB PLOTS ROW WISE
#First parameter for row and second for columns and third parameter for fisrt sub plot
'''x= np.arange(1,11)
y1=2*x
y2=3*x
print(y1)
print(y2)
plt.subplot(1,2,1)
plt.plot(x,y1,color="green",linestyle=":",linewidth=2)
plt.subplot(1,2,2)
plt.plot(x,y2,color="orange",linestyle=":",linewidth=5)
plt.title("two plots in one table")
plt.show()'''
#IF I WANT TO STACK BOTH SUB PLOTS COLUMN WISE
'''x= np.arange(1,11)
y1= 2*x
y2=3*x
print(y1)
print(y2)
plt.subplot(2,1,1)
plt.plot(x,y1,color="brown",linestyle=":", linewidth= 3)
plt.subplot(2,1,2)
plt.plot(x,y2,color="blue", linestyle="-.", linewidth=5)
plt.show()'''
#BAR PLOT
#Now we create Bar plot
#we apply bar plot on the categorical values and we apply histogram for the numerical values
'''Student= {"kajal": 87,"Arun":56,"kiran": 27}
a= list(Student.keys())
b= list(Student.values())
print(a)
print(b)
plt.bar(a,b)
plt.show()'''
#HOW CAN WE MAKE A BASIC BAR PLOT.
#plt.bar(x[])
'''how can we add labels, x-axis and y-axis in the bar plot.
how can we add grid on the bar plot'''
#THIS IS VERTICAL BAR PLOT
'''Vegetables_basket= {"Brinjal":100,"Potatoes": 145, "Tomatoes": 123}
Vegetables_name= list(Vegetables_basket.keys())
Vegetables_cost= list(Vegetables_basket.values())
plt.bar(Vegetables_name,Vegetables_cost)
plt.title("Bar Plot")
plt.xlabel("Vegetables_name")
plt.ylabel("Vegetables_cost")
plt.grid(True)
plt.show()'''
# HORIZONAL BAR PLOT
'''Vegetables_basket= {"Brinjal":100,"Potatoes": 145, "Tomatoes": 123}
Vegetables_name= list(Vegetables_basket.keys())
Vegetables_cost= list(Vegetables_basket.values())
plt.barh(Vegetables_name,Vegetables_cost, color="yellow")
plt.title("Bar Plot")
plt.xlabel("Vegetables_name")
plt.ylabel("Vegetables_cost")
plt.grid(True)
plt.show()'''
#SCATTER PLOT
'''if we have only numerical values then we can create a scatter plot which shows the relationship between two
values, it shows the corelation between two values.what is the meaning of corelation
a mutual relationship or connection between two or more things...'''
'''x=[10,20,30,40,50,60,70,80,90,100]
y=[8,1,7,2,0,3,2,1,6,5]
plt.scatter(x,y)
plt.show()'''
'''x= [4,5,6,1,2,3,7,8]
y=[80,10,40,50,34,20,80,30]
plt.scatter(x,y,color='g')
plt.title('scatter.plot')
plt.xlabel('years from starting of entity')
plt.ylabel('revenue growth in percent(%)')
plt.grid(True)
plt.show()'''
'''x=[4,5,1,6,3,5,8]
y=[8,1,4,5,2,8,3]
plt.scatter(x,y,marker="*",color='b',s=150)
plt.title("scatter plot")
plt.xlabel("x-axis")
plt.ylabel("y-axis")
plt.grid()
plt.show()'''
#ADDING TWO MARKER IN SAME PLOT
'''x= [10,20,30,40,50,60,70,80,90]
a=[8,1,7,2,0,3,7,3,2]
b=[7,2,5,6,9,1,4,5,3]
plt.scatter(x,a,marker="*",color="g",s=150)
plt.scatter(x,b,marker=".",color="orange",s=200)
plt.title("scatter plot")
plt.show()'''
#ADDING SUB-PLOTS
#STACK COLUMN-WISE
'''x=[10,20,30,40,50,60,70,80,90]
a=[10,23,70,56,78,89,90,24,59]
b=[34,89,90,78,68,46,34,23,14]
plt.subplot(1,2,1)
plt.scatter(x,a,marker="*",color="g",s= 150)
plt.title("Company Green")
plt.xlabel("years from entity origin")
plt.ylabel("revenue growth in percent(%)")
plt.grid(True)
plt.subplot(1,2,2)
plt.scatter(x,b,marker=".",color="red",s=300)
plt.title("company red")
plt.xlabel("years from entity origin")
plt.ylabel("revenue growth in percentage(%)")
plt.grid(True)
plt.subplots_adjust(left=0.1,bottom=0.1,right=0.9,top=0.9,wspace=0.4,hspace=0.4)
plt.show()'''
#stack ROW wise
'''x=[10,20,30,40,50,60,70,80,90]
a=[10,23,70,56,78,89,90,24,59]
b=[34,89,90,78,68,46,34,23,14]
plt.subplot(2,1,1)
plt.scatter(x,a,marker="*",color="g",s= 150)
plt.title("Company Green")
plt.xlabel("years from entity origin")
plt.ylabel("revenue growth in percent(%)")
plt.grid(True)
plt.subplot(2,1,2)
plt.scatter(x,b,marker=".",color="blue",s=300)
plt.title("company red")
plt.xlabel("years from entity origin")
plt.ylabel("revenue growth in percentage(%)")
plt.grid(True)
plt.subplots_adjust(left=0.1,bottom=0.1,right=0.9,top=0.9,wspace=0.4,hspace=0.4)
plt.show()'''
#........................#HISTOGRAM
'''z=[1,1,2,2,2,3,3,3,3,4]
plt.hist(z,color="g")
plt.show()'''
'''z=[1,1,2,2,2,3,3,3,3,4]
plt.hist(z,color="r", bins=4)
plt.show()'''
'''iris=pd.read_csv("iris.csv")
print("iris")
print(iris.head())
plt.hist(iris['SepalLengthCm'],bins= 30, color="g")
plt.show()'''
#..........................PIE CHART
#USE OF PIE CHART: a pie vhart is a type of graph that represents the data in the circular path
#why we use pie chart: pie chart are used to represent the propotional data or relative data in a single pie chart.
#the concept of pie slices is used to show the percentage of a particular data from the whole pie.
'''Vegetables=["Potato","Tomato","Brinjal","Chilly"]
Cost=[64,34,100,56]
plt.pie(Cost,labels=Vegetables)
plt.show()'''
'''Vegetables=["Potato","Tomato","Brinjal","Chilly"]
Cost=[64,34,100,56]
plt.pie(Cost,labels=Vegetables,autopct='%0.1f%%',colors=['yellow','grey','green','red','blue'])
plt.show()'''
#...............USE OF DOUGHNUT: chart its looks like pie chart but it has ne hole in between of circle
'''Vegetables=["Potato","Tomato","Brinjal","Chilly","carrot"]
Cost=[64,34,100,56,78]
plt.pie(Cost,labels=Vegetables,radius=1)
plt.pie(Cost,labels=Vegetables,autopct='%0.1f%%',colors=["yellow","green","grey","red","blue"])
plt.pie([1],colors=['w'],radius=0.4)
plt.show()'''
Vegetables=["Potato","Tomato","Brinjal","Chilly","carrot"]
Cost=[64,34,100,56,78]
plt.pie(Cost,labels=Vegetables,radius=1)
plt.pie(Cost,labels=Vegetables,autopct='%0.1f%%',colors=["yellow","green","grey","red","blue"])
#plt.pie(Cost,labels=Vegetables,Cost=[64,34,100,56,78],colors=["yellow","green","grey","red","blue"])
plt.pie([1],colors=['w'],radius=2)
plt.show()