Skip to content

Commit d862e34

Browse files
committed
Nicen up the animation
1 parent 2e70993 commit d862e34

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

notebooks/rainier-monolithic.ipynb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"metadata": {},
88
"outputs": [],
99
"source": [
10-
"from tqdm.notebook import trange\n",
10+
"from tqdm.notebook import trange, tqdm\n",
1111
"import numpy as np\n",
1212
"from numpy import pi as π\n",
1313
"import matplotlib.pyplot as plt\n",
@@ -700,20 +700,28 @@
700700
"source": [
701701
"%%capture\n",
702702
"\n",
703-
"from matplotlib.animation import FuncAnimation\n",
704-
"\n",
705703
"fig, axes = plt.subplots()\n",
706704
"axes.set_aspect(\"equal\")\n",
707705
"axes.set_xlim((0, 10e3))\n",
708706
"axes.set_ylim((0, 10e3))\n",
709707
"colors = firedrake.tripcolor(hs[0], vmax=130.0, num_sample_points=4, axes=axes)\n",
710-
"fig.colorbar(colors)\n",
708+
"fig.colorbar(colors);"
709+
]
710+
},
711+
{
712+
"cell_type": "code",
713+
"execution_count": null,
714+
"id": "66704ac7-81e5-4586-be98-86f821228ca4",
715+
"metadata": {},
716+
"outputs": [],
717+
"source": [
718+
"from matplotlib.animation import FuncAnimation\n",
711719
"\n",
712720
"fn_plotter = firedrake.FunctionPlotter(mesh, num_sample_points=4)\n",
713721
"def animate(h):\n",
714722
" colors.set_array(fn_plotter(h))\n",
715723
"\n",
716-
"animation = FuncAnimation(fig, animate, hs, interval=1e3/60)"
724+
"animation = FuncAnimation(fig, animate, tqdm(hs), interval=1e3/60)"
717725
]
718726
},
719727
{

0 commit comments

Comments
 (0)