-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmat.py
More file actions
53 lines (40 loc) · 1.22 KB
/
Copy pathmat.py
File metadata and controls
53 lines (40 loc) · 1.22 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
import matplotlib.pyplot as plt
import numpy as np
# Bar
subject = ['Math', 'Science','English','History','Computer']
marks = [85, 90, 78, 88, 95]
plt.figure(figsize = (10, 6))
plt.bar(subject, marks,color = 'pink', edgecolor='black')
plt.title("Bar Chart Representation")
plt.xlabel("Subjects")
plt.ylabel("Marks")
plt.grid(axis = 'y', linestyle = '--', alpha=0.7)
plt.show();
# Histogram
ages = np.random.randint(18, 50, 100)
plt.figure(figsize= (10, 6))
plt.hist(ages, color = 'lightgreen',edgecolor = 'black')
plt.title("Histrogram Representation")
plt.xlabel("Age")
plt.ylabel("Frequency")
plt.grid(axis= 'y', linestyle='-', alpha=0.7)
plt.show()
# Scatter
x = np.random.randint(1, 50, 30)
y = np.random.randint(1, 50, 30)
plt.figure(figsize=(10, 6))
plt.scatter(x, y, color='red', s=80, edgecolors='black')
plt.title("Scatter plot presentation")
plt.xlabel("X Values")
plt.ylabel("Y Values")
plt.grid(True, linestyle='--',alpha = 0.6)
plt.show()
#Line Graph
months = ['Jan','Feb','Mar','Apr','May','Jun']
sales = [120, 50, 180, 20, 260, 30]
plt.figure(figsize=(10, 6))
plt.plot(months, sales, marker = 'o', color='purple', linewidth = 2)
plt.xlabel("Months")
plt.ylabel("Sales")
plt.grid(True,linestyle = '--', alpha=0.6)
plt.show()