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

11th Jul 2022, 11:40 AM
praneetha
praneetha - avatar
2 odpowiedzi
+ 3
plt.clf() or plt.close() after mains.png
11th Jul 2022, 11:52 AM
SomeAwesome
SomeAwesome - avatar
+ 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')
11th Jul 2022, 12:00 PM
Bob_Li
Bob_Li - avatar