0

# My Code aināt working here, Guys please help.?

import numpy as np from matplotlib import pyplot as plt x = np.linspace(-2, 2, 100) y1 = np.cos(np.pi * x) y2 = np.sin(np.pi * x) plt.plot(x, y1, 'go') plt.plot(x, y2, 'r-') plt.xlabel('xlabel') plt.ylabel('ylabel') plt.grid(alpha=0.4) plt.title('Kelvin Diagram') plt.show()

2 Answers

+ 3

Add
plt.savefig("plot.png")
after plt.show()

0

Thanks bro