CBSE Class 12 Informatics Practices Question 48 of 73

Data Visualization using Matplotlib — Question 13

Back to all questions
13
Question

Question 13

Plot a line graph for: y2 = 4*x

Answer
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(1, 5)
y = np.sqrt(4 * x)
plt.plot(x, y)
plt.title('Line Graph of y² = 4x')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
Output
Plot a line graph for: y^2 = 4\*x. Data Visualization using Matplotlib, Informatics Practices Preeti Arora Solutions CBSE Class 12