Skip to content

Commit 4caf506

Browse files
authored
Add files via upload
1 parent b68b5cf commit 4caf506

File tree

12 files changed

+146
-0
lines changed

12 files changed

+146
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from matplotlib import pyplot as plt
2+
3+
x = [4, 8, 9]
4+
y = [10, 12, 15]
5+
plt.plot(x, y)
6+
plt.title("Line graph")
7+
plt.ylabel('Y axis')
8+
plt.xlabel('X axis')
9+
plt.show()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from matplotlib import pyplot as plt
2+
from matplotlib import style
3+
4+
style.use('ggplot')
5+
x = [16, 8, 10]
6+
y = [8, 16, 6]
7+
x2 = [8, 15, 11]
8+
y2 = [6, 15, 7]
9+
plt.plot(x, y, 'r', label='line one', linewidth=5)
10+
plt.plot(x2, y2, 'm', label='line two', linewidth=5)
11+
plt.title('Epic Info')
12+
fig = plt.figure()
13+
plt.ylabel('Y axis')
14+
plt.xlabel('X axis')
15+
plt.legend()
16+
plt.grid(True, color='k')
17+
plt.show()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from matplotlib import pyplot as plt
2+
3+
players = [ 'Ankit', 'Dhoni', 'Rohit','Shikhar']
4+
runs = [51,87,45,67]
5+
plt.bar(players,runs,color = 'green')
6+
plt.title('Score Card')
7+
plt.xlabel('Players')
8+
plt.ylabel('Runs')
9+
plt.show()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from matplotlib import pyplot as plt
2+
3+
players = ['Ankit', 'Dhoni', 'Rohit','Shikhar']
4+
runs = [51,87,45,67]
5+
plt.barh(players,runs, color = 'green')
6+
plt.title('Score Card')
7+
plt.xlabel('Players')
8+
plt.ylabel('Runs')
9+
plt.show()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from matplotlib import pyplot as plt
2+
3+
population_age = [21,53,60,49,25,27,30,42,40,1,2,102,95,8,15,105,70,65,55,70,75,60,52,44,43,42,45]
4+
bins = [0,10,20,30,40,50,60,70,80,90,100]
5+
plt.hist(population_age, bins, histtype='bar', rwidth=0.8)
6+
plt.xlabel('age groups')
7+
plt.ylabel('Number of people')
8+
plt.title('Histogram')
9+
plt.show()
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from matplotlib import pyplot as plt
2+
# Importing Numpy Library
3+
import numpy as np
4+
5+
plt.style.use('fivethirtyeight')
6+
mu = 50
7+
sigma = 7
8+
x = np.random.normal(mu, sigma, size=200)
9+
fig, ax = plt.subplots()
10+
ax.hist(x, 20)
11+
ax.set_title('Historgram')
12+
ax.set_xlabel('bin range')
13+
ax.set_ylabel('frequency')
14+
fig.tight_layout()
15+
plt.show()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from matplotlib import pyplot as plt
2+
3+
# Pie chart, where the slices will be ordered and plotted counter-clockwise:
4+
Players = 'Ankit', 'Dhoni', 'Rohit', 'Yuvraj'
5+
Runs = [25, 30, 15, 10]
6+
explode = (0, 0.1, 0, 0) # it "explode" the 2nd slice
7+
fig1, ax1 = plt.subplots()
8+
ax1.pie(Runs, explode=explode, labels=Players, autopct='%1.1f%%', shadow=True, startangle=90)
9+
ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
10+
plt.show()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from matplotlib import pyplot as plt
2+
from matplotlib import style
3+
4+
style.use('ggplot')
5+
x = [5, 7, 10]
6+
y = [18, 10, 6]
7+
x2 = [6, 9, 11]
8+
y2 = [7, 14, 17]
9+
plt.scatter(x, y)
10+
plt.scatter(x2, y2, color='g')
11+
plt.title('Epic Info')
12+
plt.ylabel('Y axis')
13+
plt.xlabel('X axis')
14+
plt.show()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import matplotlib.pyplot as plt
2+
3+
x = [2, 2.5, 3, 3.5, 4.5, 4.7, 5.0]
4+
y = [7.5, 8, 8.5, 9, 9.5, 10, 10.5]
5+
x1 = [9, 8.5, 9, 9.5, 10, 10.5, 12]
6+
y1 = [3, 3.5, 4.7, 4, 4.5, 5, 5.2]
7+
plt.scatter(x, y, label='high income low saving', color='g')
8+
plt.scatter(x1, y1, label='low income high savings', color='r')
9+
plt.xlabel('saving*100')
10+
plt.ylabel('income*1000')
11+
plt.title('Scatter Plot')
12+
plt.legend()
13+
plt.show()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from mpl_toolkits import mplot3d
2+
import numpy as np
3+
import matplotlib.pyplot as plt
4+
5+
fig = plt.figure()
6+
ax = plt.axes(projection='3d')
7+
z = np.linspace(0, 1, 100)
8+
x = z * np.sin(20 * z)
9+
y = z * np.cos(20 * z)
10+
ax.plot3D(x, y, z, 'gray')
11+
ax.set_title('3D line plot')
12+
plt.show()

0 commit comments

Comments
 (0)