CBSE Class 12 Informatics Practices Question 43 of 73

Data Visualization using Matplotlib — Question 8

Back to all questions
8
Question

Question 8

Write a Python program to draw a line with a suitable label in the X-axis and Y-axis, and a title.

Answer
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4, 5], [2, 4, 6, 8, 10])
plt.title("Line Graph")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()
Output
Write a Python program to draw a line with a suitable label in the X-axis and Y-axis, and a title. Data Visualization using Matplotlib, Informatics Practices Preeti Arora Solutions CBSE Class 12