Skip to content

Commit 9593ffc

Browse files
committed
more alt-text
1 parent 5e23dbb commit 9593ffc

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

content/04-matplotlib/matplotlib-exercises.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@
286286
],
287287
"source": [
288288
"fig, ax = plt.subplots()\n",
289-
"ax.imshow(m)"
289+
"ax.imshow(m)\n",
290+
"# alt-text: a plot of the Mandelbrot set"
290291
]
291292
},
292293
{
@@ -313,7 +314,7 @@
313314
"name": "python",
314315
"nbconvert_exporter": "python",
315316
"pygments_lexer": "ipython3",
316-
"version": "3.12.3"
317+
"version": "3.14.2"
317318
}
318319
},
319320
"nbformat": 4,

content/05-scipy/scipy-basics.ipynb

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@
538538
"x_fine = np.linspace(0, 20, 10*N)\n",
539539
"\n",
540540
"ax.scatter(x, y)\n",
541-
"ax.plot(x_fine, f_exact(x_fine), ls=\":\", label=\"original function\")"
541+
"ax.plot(x_fine, f_exact(x_fine), ls=\":\", label=\"original function\")\n",
542+
"# alt-text: a figure showing data points and an interpolant passing through them"
542543
]
543544
},
544545
{
@@ -578,7 +579,8 @@
578579
"ax.plot(x_fine, f_interp(x_fine), label=\"interpolant\")\n",
579580
"\n",
580581
"ax.legend(frameon=False, loc=\"best\")\n",
581-
"fig"
582+
"fig\n",
583+
"# alt-text: a figure showing data points, an interpolant to them, and the original function we sampled"
582584
]
583585
},
584586
{
@@ -666,7 +668,8 @@
666668
"fig, ax = plt.subplots()\n",
667669
"data = func(x, y)\n",
668670
"im = ax.imshow(data.T, extent=(0, 1, 0, 1), origin=\"lower\")\n",
669-
"fig.colorbar(im, ax=ax)"
671+
"fig.colorbar(im, ax=ax)\n",
672+
"# alt-text: a heat-map figure showing a function with small-amplitude ripples"
670673
]
671674
},
672675
{
@@ -714,7 +717,8 @@
714717
"source": [
715718
"fig, ax = plt.subplots()\n",
716719
"im = ax.imshow(coarse.T, extent=(0, 1, 0, 1), origin=\"lower\")\n",
717-
"fig.colorbar(im, ax=ax)"
720+
"fig.colorbar(im, ax=ax)\n",
721+
"# alt-text: a heat-map showing coarsened representation of our function"
718722
]
719723
},
720724
{
@@ -820,7 +824,8 @@
820824
"source": [
821825
"fig, ax = plt.subplots()\n",
822826
"im = ax.imshow(new_data.T, extent=(0, 1, 0, 1), origin=\"lower\")\n",
823-
"fig.colorbar(im, ax=ax)"
827+
"fig.colorbar(im, ax=ax)\n",
828+
"# alt-text: a heat-map showing the reconstructed function via interpolation"
824829
]
825830
},
826831
{
@@ -860,7 +865,8 @@
860865
"diff = new_data - data\n",
861866
"fig, ax = plt.subplots()\n",
862867
"im = ax.imshow(diff.T, origin=\"lower\", extent=(0, 1, 0, 1))\n",
863-
"fig.colorbar(im, ax=ax)"
868+
"fig.colorbar(im, ax=ax)\n",
869+
"# alt-text: a heat-map showing the error in our interpolation. It is better than 10%"
864870
]
865871
},
866872
{
@@ -964,7 +970,8 @@
964970
"fig, ax = plt.subplots()\n",
965971
"ax.plot(x, f(x))\n",
966972
"ax.scatter(np.array([root]), np.array([f(root)]))\n",
967-
"ax.grid()"
973+
"ax.grid()\n",
974+
"# alt-text: a plot of our function with the root represented as a point"
968975
]
969976
},
970977
{
@@ -1104,7 +1111,8 @@
11041111
"fig = plt.figure()\n",
11051112
"ax = plt.axes(projection='3d')\n",
11061113
"ax.plot(X[0,:], X[1,:], X[2,:])\n",
1107-
"fig.set_size_inches(8.0,6.0)"
1114+
"fig.set_size_inches(8.0,6.0)\n",
1115+
"# alt-text: a 3D line plot of the solution -- it is dominated by two lobe-like structures"
11081116
]
11091117
},
11101118
{
@@ -1192,13 +1200,14 @@
11921200
"\n",
11931201
"ax.plot(X[0,:], X[1,:], X[2,:])\n",
11941202
"\n",
1195-
"ax.scatter(sol1.x[0], sol1.x[1], sol1.x[2], marker=\"x\", color=\"r\")\n",
1196-
"ax.scatter(sol2.x[0], sol2.x[1], sol2.x[2], marker=\"x\", color=\"r\")\n",
1197-
"ax.scatter(sol3.x[0], sol3.x[1], sol3.x[2], marker=\"x\", color=\"r\")\n",
1203+
"ax.scatter(sol1.x[0], sol1.x[1], sol1.x[2], marker=\"x\", color=\"C1\")\n",
1204+
"ax.scatter(sol2.x[0], sol2.x[1], sol2.x[2], marker=\"x\", color=\"C1\")\n",
1205+
"ax.scatter(sol3.x[0], sol3.x[1], sol3.x[2], marker=\"x\", color=\"C1\")\n",
11981206
"\n",
11991207
"ax.set_xlabel(\"x\")\n",
12001208
"ax.set_ylabel(\"y\")\n",
1201-
"ax.set_zlabel(\"z\")"
1209+
"ax.set_zlabel(\"z\")\n",
1210+
"# alt-text: the 3D solution again represented as a line / trajectory, now with the stable-points marked"
12021211
]
12031212
},
12041213
{
@@ -1342,7 +1351,8 @@
13421351
"ax.loglog(ts, Ys[2,:], label=r\"$y_3$\")\n",
13431352
"\n",
13441353
"ax.legend(loc=\"best\", frameon=False)\n",
1345-
"ax.set_xlabel(\"time\")"
1354+
"ax.set_xlabel(\"time\")\n",
1355+
"# alt-text: the time-evolution of the species on a log scale"
13461356
]
13471357
},
13481358
{
@@ -1373,7 +1383,7 @@
13731383
"name": "python",
13741384
"nbconvert_exporter": "python",
13751385
"pygments_lexer": "ipython3",
1376-
"version": "3.13.3"
1386+
"version": "3.14.2"
13771387
}
13781388
},
13791389
"nbformat": 4,

0 commit comments

Comments
 (0)