Update SIR_model.py
Browse files- SIR_model.py +3 -3
SIR_model.py
CHANGED
|
@@ -215,9 +215,9 @@ def main(total_population=1000, initial_infected=1, initial_recovered=0, beta=0.
|
|
| 215 |
image = image.reshape(fig.canvas.get_width_height()[::-1] + (3,))
|
| 216 |
frames.append(image)
|
| 217 |
plt.close(fig)
|
| 218 |
-
|
| 219 |
# Save the frames as a GIF
|
| 220 |
-
imageio.mimsave(
|
| 221 |
# # Create an animated line graph
|
| 222 |
# fig2, ax = plt.subplots()
|
| 223 |
# ax.plot(times, s, label='Susceptible', color='blue')
|
|
@@ -252,7 +252,7 @@ def main(total_population=1000, initial_infected=1, initial_recovered=0, beta=0.
|
|
| 252 |
# plt.show()
|
| 253 |
|
| 254 |
# return [fig1, anim]
|
| 255 |
-
return [fig1]
|
| 256 |
|
| 257 |
elif mode=="graph":
|
| 258 |
|
|
|
|
| 215 |
image = image.reshape(fig.canvas.get_width_height()[::-1] + (3,))
|
| 216 |
frames.append(image)
|
| 217 |
plt.close(fig)
|
| 218 |
+
gif_path = 'animated_plot.gif'
|
| 219 |
# Save the frames as a GIF
|
| 220 |
+
imageio.mimsave(gif_path, frames, fps=20)
|
| 221 |
# # Create an animated line graph
|
| 222 |
# fig2, ax = plt.subplots()
|
| 223 |
# ax.plot(times, s, label='Susceptible', color='blue')
|
|
|
|
| 252 |
# plt.show()
|
| 253 |
|
| 254 |
# return [fig1, anim]
|
| 255 |
+
return [fig1, gif_path]
|
| 256 |
|
| 257 |
elif mode=="graph":
|
| 258 |
|