// Business as usual
if (gif is not None) and (gif != ""):
if gif.endswith(".gif"):
gif = gif[:-4]
ani.save("%s.gif" % gif, writer="imagemagick")
else:
plt.show()
plt.close()
After Change
try:
if "zmqshell" in str(type(get_ipython())):
plt.close()
display(HTML(ani.to_jshtml()))
else:
raise NameError("")
except NameError:
plt.show()