import matplotlib.pyplot as pltimport numpy as np
x = np.linspace(-10, 10, 100)y1 = 3xy2 = 3x + 4
plt.figure()plt.plot(x, y1, label='y=3x')plt.plot(x, y2, label='y=3x+4')plt.xlabel('x')plt.ylabel('y')plt.legend()plt.grid(True)plt.show()
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-10, 10, 100)
y1 = 3x
y2 = 3x + 4
plt.figure()
plt.plot(x, y1, label='y=3x')
plt.plot(x, y2, label='y=3x+4')
plt.xlabel('x')
plt.ylabel('y')
plt.legend()
plt.grid(True)
plt.show()