CBSE Class 12 Informatics Practices Question 45 of 73

Data Visualization using Matplotlib — Question 10

Back to all questions
10
Question

Question 10

Write a Python program to plot two or more lines and set the line markers.

Answer
import matplotlib.pyplot as plt
x1 = [10,20,30]
y1 = [20,40,10]
plt.plot(x1, y1, marker='o', label='line1-circle')
x2 = [10,20,30]
y2 = [40,10,30]
plt.plot(x2, y2, marker='s', label='line2-square')
plt.show()
Output
Write a Python program to plot two or more lines and set the line markers. Data Visualization using Matplotlib, Informatics Practices Preeti Arora Solutions CBSE Class 12