0
[solved] The second graph shows the data from first graph too. Is there a way I can make this not happen?
There is data for two graphs in this code. First graph is fine but the second graph includes the first graph too. Why does this happen? How can I not make it happen? https://code.sololearn.com/cJgDS7dEI3vS/?ref=app
2 Answers
+ 3
plt.clf() or plt.close()
after mains.png
+ 1
import matplotlib.pyplot as plt
plt.figure(0)
plt.title('Graph 1')
graph1 = [300,99,23,24,44,45,3,19,44]
plt.plot(graph1, color='r')
plt.savefig('mains.png')
plt.figure(1)
plt.title('Graph 2')
graph2 = [300,171,63,96,19]
plt.plot(graph2, color='g')
plt.savefig('mains2.png')