• import matplotlib.
pyplot as plt
• import numpy as np
• xpoi = np.array([0, 6])
• ypoi = np.array([0, 250])
• plt.plot(xpoi, ypoi)
• plt.show()
• import matplotlib.pyplot as plt
• import numpy as np
• xpoi = np.array([1, 8])
• ypoi = np.array([3, 10])
• plt.plot(xpoi, ypoi)
• plt.show()
https://www.w3schools.com/python/matplotlib_markers.asp
• import matplotlib.pyplot as plt
• import numpy as np
• ypoints = np.array([3, 8, 1, 10])
• plt.plot(ypoints, marker = 'o')
• plt.show()
https://www.w3schools.com/python/matplotlib_line.asp
• import matplotlib.pyplot as plt
• import numpy as np
• ypoi = np.array([3, 8, 1, 10])
• plt.plot(ypoi, linestyle = 'dotted')
• plt.show()
• import matplotlib.pyplot as plt
• import numpy as np
• ypoi = np.array([3, 8, 1, 10])
• plt.plot(ypoi, linestyle = ‘dashed')
• plt.show()
• import matplotlib.pyplot as plt
• import numpy as np
• ypoi = np.array([3, 8, 1, 10])
• plt.plot(ypoi, linestyle =
'dashdot')
• plt.show()
• import numpy as np
• import matplotlib.pyplot as plt
• x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125])
• y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320,
330])
• plt.plot(x, y)
• plt.xlabel("Average Pulse")
• plt.ylabel("Calorie Burnage")
• plt.show()
https://www.w3schools.com/python/matplotlib_labels.asp
import numpy as np
import matplotlib.pyplot as plt
x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125])
y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330])
plt.plot(x, y)
plt.title("Sports Watch Data")
plt.xlabel("Average Pulse")
plt.ylabel("Calorie Burnage")
plt.show()
• import numpy as np
• import matplotlib.pyplot as plt
• x = np.array([80, 85, 90, 95, 100, 105, 110, 115, 120, 125])
• y = np.array([240, 250, 260, 270, 280, 290, 300, 310, 320, 330])
• plt.title("Sports Watch Data")
• plt.xlabel("Average Pulse")
• plt.ylabel("Calorie Burnage")
• plt.plot(x, y)
• plt.grid()
• plt.show()
import matplotlib.pyplot as plt
import numpy as np
#plot 1:
x = np.array([0, 1, 2, 3])
y = np.array([3, 8, 1, 10])
plt.subplot(1, 2, 1)
plt.plot(x,y)
#plot 2:
x = np.array([0, 1, 2, 3])
y = np.array([10, 20, 30, 40])
plt.subplot(1, 2, 2)
plt.plot(x,y)
plt.show()
import matplotlib.pyplot as plt
import numpy as np
#plot 1:
x = np.array([0, 1, 2, 3])
y = np.array([3, 8, 1, 10])
plt.subplot(2, 1, 1)
plt.plot(x,y)
#plot 2:
x = np.array([0, 1, 2, 3])
y = np.array([10, 20, 30, 40])
plt.subplot(2, 1, 2)
plt.plot(x,y)
plt.show()
• import matplotlib.pyplot as plt
import numpy as np
x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6])
y=
np.array([99,86,87,88,111,86,103,87,94,78,77,85,86])
plt.scatter(x, y)
plt.show()
• import matplotlib.pyplot as plt
• import numpy as np
• x = np.array(["A", "B", "C", "D", "E"])
• y = np.array([3, 8, 1, 10, 5])
• plt.bar(x,y)
• plt.show()
import matplotlib.pyplot as plt
import numpy as np
x = np.array(["A", "B", "C", "D"])
y = np.array([3, 8, 1, 10])
plt.barh(x, y)
plt.show()
import matplotlib.pyplot as plt
import numpy as np
x = np.array(["A", "B", "C", "D"])
y = np.array([3, 8, 1, 10])
plt.bar(x, y, color = "red")
plt.show()
t matplotlib.pyplot as plt
[32, 96, 45, 67, 76, 28, 79, 62, 43, 81, 70,61, 95, 44, 60, 69, 71, 23
9, 54, 76, 67,82, 97, 26, 34, 18, 16, 59, 88, 29, 30, 66,23, 65, 72,
, 78, 49, 73, 62, 87, 37, 68,81, 80, 77, 92, 81, 52, 43, 68, 71, 86]
t(data)
ow()
matplotlib.pyplot as plt
umpy as np
ate random data for the histogram
p.random.randint(0,10,50)
a)
g a basic histogram
data, color='skyblue')
labels and title
l('Values')
l('Frequency')
Basic Histogram')
y the plot
()
Concept of bins in histogram
• import matplotlib.pyplot as plt
•
• hei = [189, 185, 195, 149, 189, 147, 154,
• 174, 169, 195, 159, 192, 155, 191,
• 153, 157, 140, 144, 172, 157, 181,
• 182, 166, 167]
•
• plt.hist(hei, edgecolor="red" , bins=10)
• plt.show()
• import matplotlib.pyplot as plt
•
• values = [87, 53, 66, 61, 67, 68, 62, 110, 104, 61, 111, 123,
117, 119, 116, 104, 92, 111, 90, 103, 81, 80, 101, 51, 79,
107, 110, 129, 145, 139, 110]
•
• plt.hist(values, bins=7, edgecolor="yellow", color="green")
• plt.show()
• import matplotlib.pyplot as plt
import numpy as np
y = np.array([35, 25, 25, 15])
plt.pie(y)
plt.show()
import matplotlib.pyplot as plt
import numpy as np
y = np.array([35, 25, 25, 15])
mylabels = ["Apples", "Bananas", "Cherries", "Dates"]
plt.pie(y, labels = mylabels)
plt.show()