jupyter notebook上でanimationを実行する

jupyterでpython3のコードを書きながらアニメーションを実装しようとしたところ、なかなかうまく行かなかった。
調べてみたところ、jupyter上でアニメーションさせるときはplotを表示させるのではなく実装したアニメーションを直接呼び出す必要があった。

from matplotlib import pyplot as plt
from matplotlib import animation

def update_radius(i, circle):
    circle.radius = i*0.5
    return circle,

fig = plt.gcf()
ax = plt.axes(xlim=(-10,10), ylim=(-10,10))
ax.set_aspect('equal')
circle = plt.Circle((0,0), 0.05)
ax.add_patch(circle)
anim = animation.FuncAnimation(fig, update_radius, fargs=(circle, ), frames=30, interval=50)
anim

これをjupyter上で実行すると、徐々に円が大きくなっていくアニメーションが繰り返し表示される。
本やサイトによっては最後のところをplt.show()としていたり%matplotlib nbaggを記述したりしているが、今回は最後にアニメーションのインスタンスを呼び出すだけで表示できた。