Practical No.2
Practical No.2
Adding Multiple lines
In this practical we will draw a graph with multiple lines. You can practice with different data.
import matplotlib.pyplot as plt
x = [1, 3, 6]
y = [2, 10, 5]
x2 = [1, 4, 6]
y2 = [4, 7, 3]
plt.plot(x, y)
plt.plot(x2, y2)
plt.show()
Practical No.3
Adding ?Labels
In this practical you will learn to add labels in graphs.
import matplotlib.pyplot as plt
x = [1, 3, 6]
y = [2, 10, 5]
x2 = [1, 4, 6]
y2 = [4, 7, 3]
plt.plot(x, y)
plt.plot(x2, y2)
plt.xlabel("X axis Name")
plt.ylabel("Y axis Name")
plt.show()
Adding Legend
import matplotlib.pyplot as plt
x = [1, 3, 6]
y = [2, 10, 5]
x2 = [1, 4, 6]
y2 = [4, 7, 3]
plt.plot(x, y, label="First Line")
plt.plot(x2, y2, label="Second Line")
plt.xlabel("First Line")
plt.ylabel("Second Line")
plt.legend() plt.show()
Would you like to enjoy this https://www.youtube.com/watch?v=UJvILLhWEGY