-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataVisulizer.py
More file actions
69 lines (62 loc) · 2.36 KB
/
DataVisulizer.py
File metadata and controls
69 lines (62 loc) · 2.36 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
import matplotlib.pyplot as plt
import numpy as np
def ask():
print("welcome to MATPLOT LIB\nHere you can create garph pie \nchart with simple input data")
print("1-->To craete graph\n2-->To create Pie Chart\n3-->To create Bar graph")
print("0 to end program")
def run():
ask()
req=int(input("Enter Here->"))
#if-else
if req==1:
#exapmle
# l2=[50,130,260,450,600,720,800,850,880]
# l1=[1,2,3,4,5,6,7,8,9]
l1=[]
l2=[]
print("You have choose to craete line graph")
no_data=int(input("Enter the number of data you want to in Both X and Y axis "))
for i in range(no_data):
l1.append(input("Enter {} element:".format(i+1)))
print("\nEnter elemnt for Y axis:")
for i3 in range(no_data):
l2.append(input("enter {} element ".format(i3+1)))
plt.plot(l1,l2,marker='o')
plt.xlabel("age (years)")
plt.ylabel("Height (cm)")
plt.title("Height Estimation")
print("Program Run Succesfully")
plt.show()
elif(req==0):
print("Program end")
elif(req==3):
l1=[]
l2=[]
print("You have choose to create bar graph")
no_data=int(input("Enter the number of data you want to in Both X and Y axis "))
for i in range(no_data):
l1.append(float(input("Enter {} element:".format(i+1))))
print("\nEnter elemnt for Y axis:")
for i3 in range(no_data):
l2.append(input("enter {} elemnt ".format(i3+1)))
plt.bar(l1,l2,width=5)
plt.title("Bar Graph")
plt.xlabel("X axis-->")
plt.ylabel("Y axis ")
plt.show()
elif(req==2):
print("You have selected to createing Pie chart")
l1=[]
l2=[]
print("You have choose to craete pie graph")
no_data=int(input("Enter the number of data you want to in both X and Y axis "))
for i in range(no_data):
l1.append(float(input("Enter Numeric data {} element:".format(i+1))))
print("\nEnter elemnt for Y axis:")
for i3 in range(no_data):
l2.append(input("Enter string type {} elemnt ".format(i3+1)))
plt.figure(figsize=(8,6))
plt.pie(l1,labels=l2,autopct='%1.1f%%')
plt.title("Pie Chart")
plt.show()
run()