Informatics Practices
Plot a line graph for: y2 = 4*x
PyPlot
2 Likes
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

Answered By
2 Likes
Related Questions
Write a Python program to display a bar chart of the number of students in a class. Use different colors for each bar.
Sample data:
Class: I, II, III, IV, V, VI, VII, VIII, IX, X
Strengths: 40, 43, 45, 47, 49, 38, 50, 37, 43, 39Write a Python program to display a horizontal bar chart of the number of students in a class.
Sample data:
Class: I, II, III, IV, V, VI, VII, VIII, IX, X
Strengths: 40, 43, 45, 47, 49, 38, 50, 37, 43, 39Write a Python program to plot the function y = x2 using the Matplotlib library.
Name the various methods used with pyplot object.