Skip to content

Commit c0d52ca

Browse files
Update matplotlib.figure.Figure.add_subplot call to take integer arguments.
PiperOrigin-RevId: 487816510
1 parent ed5c9ac commit c0d52ca

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

Diff for: tensorflow_graphics/notebooks/intrinsics_optimization.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,13 @@
289289
"source": [
290290
"def plot_optimization_step(observation, prediction):\n",
291291
" plt.figure(figsize=(20, 10))\n",
292-
" ax = plt.subplot(\"131\")\n",
292+
" ax = plt.subplot(1, 3, 1)\n",
293293
" ax.set_title(\"Observation\")\n",
294294
" _ = ax.imshow(observation)\n",
295-
" ax = plt.subplot(\"132\")\n",
295+
" ax = plt.subplot(1, 3, 2)\n",
296296
" ax.set_title(\"Prediction using estimated intrinsics\")\n",
297297
" _ = ax.imshow(prediction)\n",
298-
" ax = plt.subplot(\"133\")\n",
298+
" ax = plt.subplot(1, 3, 3)\n",
299299
" ax.set_title(\"Difference image\")\n",
300300
" _ = ax.imshow(np.abs(observation - prediction))\n",
301301
" plt.show()\n",

Diff for: tensorflow_graphics/notebooks/reflectance.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
"\n",
258258
"# Diffuse\n",
259259
"radiance_lambertian = np.transpose(radiance_lambertian, (1, 0, 2))\n",
260-
"ax = plt.subplot(\"131\")\n",
260+
"ax = plt.subplot(1, 3, 1)\n",
261261
"ax.axes.get_xaxis().set_visible(False)\n",
262262
"ax.axes.get_yaxis().set_visible(False)\n",
263263
"ax.grid(False)\n",
@@ -266,7 +266,7 @@
266266
"\n",
267267
"# Specular\n",
268268
"radiance_phong = np.transpose(radiance_phong, (1, 0, 2))\n",
269-
"ax = plt.subplot(\"132\")\n",
269+
"ax = plt.subplot(1, 3, 2)\n",
270270
"ax.axes.get_xaxis().set_visible(False)\n",
271271
"ax.axes.get_yaxis().set_visible(False)\n",
272272
"ax.grid(False)\n",
@@ -275,7 +275,7 @@
275275
"\n",
276276
"# Diffuse + specular\n",
277277
"radiance = np.transpose(radiance, (1, 0, 2))\n",
278-
"ax = plt.subplot(\"133\")\n",
278+
"ax = plt.subplot(1, 3, 3)\n",
279279
"ax.axes.get_xaxis().set_visible(False)\n",
280280
"ax.axes.get_yaxis().set_visible(False)\n",
281281
"ax.grid(False)\n",

Diff for: tensorflow_graphics/notebooks/spherical_harmonics_approximation.ipynb

+10-10
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,19 @@
250250
" 1.0)\n",
251251
"# Plots results.\n",
252252
"plt.figure(figsize=(10, 10))\n",
253-
"ax = plt.subplot(\"131\")\n",
253+
"ax = plt.subplot(1, 3, 1)\n",
254254
"ax.axes.get_xaxis().set_visible(False)\n",
255255
"ax.axes.get_yaxis().set_visible(False)\n",
256256
"ax.grid(False)\n",
257257
"ax.set_title(\"Original lighting function\")\n",
258258
"_ = ax.imshow(sampled_light_function, vmin=vmin, vmax=vmax)\n",
259-
"ax = plt.subplot(\"132\")\n",
259+
"ax = plt.subplot(1, 3, 2)\n",
260260
"ax.axes.get_xaxis().set_visible(False)\n",
261261
"ax.axes.get_yaxis().set_visible(False)\n",
262262
"ax.grid(False)\n",
263263
"ax.set_title(\"Spherical Harmonics approximation\")\n",
264264
"_ = ax.imshow(reconstructed_light_function, vmin=vmin, vmax=vmax)\n",
265-
"ax = plt.subplot(\"133\")\n",
265+
"ax = plt.subplot(1, 3, 3)\n",
266266
"ax.axes.get_xaxis().set_visible(False)\n",
267267
"ax.axes.get_yaxis().set_visible(False)\n",
268268
"ax.grid(False)\n",
@@ -347,19 +347,19 @@
347347
" np.amax(np.maximum(sampled_brdf, reconstructed_brdf)), 1.0 / np.pi)\n",
348348
"# Plots results.\n",
349349
"plt.figure(figsize=(10, 10))\n",
350-
"ax = plt.subplot(\"131\")\n",
350+
"ax = plt.subplot(1, 3, 1)\n",
351351
"ax.axes.get_xaxis().set_visible(False)\n",
352352
"ax.axes.get_yaxis().set_visible(False)\n",
353353
"ax.grid(False)\n",
354354
"ax.set_title(\"Original reflectance function\")\n",
355355
"_ = ax.imshow(sampled_brdf, vmin=vmin, vmax=vmax)\n",
356-
"ax = plt.subplot(\"132\")\n",
356+
"ax = plt.subplot(1, 3, 2)\n",
357357
"ax.axes.get_xaxis().set_visible(False)\n",
358358
"ax.axes.get_yaxis().set_visible(False)\n",
359359
"ax.grid(False)\n",
360360
"ax.set_title(\"Zonal Harmonics approximation\")\n",
361361
"_ = ax.imshow(reconstructed_brdf, vmin=vmin, vmax=vmax)\n",
362-
"ax = plt.subplot(\"133\")\n",
362+
"ax = plt.subplot(1, 3, 3)\n",
363363
"ax.axes.get_xaxis().set_visible(False)\n",
364364
"ax.axes.get_yaxis().set_visible(False)\n",
365365
"ax.grid(False)\n",
@@ -438,13 +438,13 @@
438438
" vector.dot(sh_coefficients, rotated_zonal_coefficients))\n",
439439
"\n",
440440
"plt.figure(figsize=(10, 10))\n",
441-
"ax = plt.subplot(\"121\")\n",
441+
"ax = plt.subplot(1, 2, 1)\n",
442442
"ax.set_title(\"Zonal SH\")\n",
443443
"ax.axes.get_xaxis().set_visible(False)\n",
444444
"ax.axes.get_yaxis().set_visible(False)\n",
445445
"ax.grid(False)\n",
446446
"_ = ax.imshow(reconstructed_brdf)\n",
447-
"ax = plt.subplot(\"122\")\n",
447+
"ax = plt.subplot(1, 2, 2)\n",
448448
"ax.set_title(\"Rotated version\")\n",
449449
"ax.axes.get_xaxis().set_visible(False)\n",
450450
"ax.axes.get_yaxis().set_visible(False)\n",
@@ -573,13 +573,13 @@
573573
"gt = np.transpose(gt, (1, 0))\n",
574574
"\n",
575575
"plt.figure(figsize=(10, 20))\n",
576-
"ax = plt.subplot(\"121\")\n",
576+
"ax = plt.subplot(1, 2, 1)\n",
577577
"ax.axes.get_xaxis().set_visible(False)\n",
578578
"ax.axes.get_yaxis().set_visible(False)\n",
579579
"ax.grid(False)\n",
580580
"ax.set_title(\"SH light and SH BRDF\")\n",
581581
"_ = ax.imshow(sh_integration, vmin=0.0)\n",
582-
"ax = plt.subplot(\"122\")\n",
582+
"ax = plt.subplot(1, 2, 2)\n",
583583
"ax.axes.get_xaxis().set_visible(False)\n",
584584
"ax.axes.get_yaxis().set_visible(False)\n",
585585
"ax.grid(False)\n",

Diff for: tensorflow_graphics/notebooks/spherical_harmonics_optimization.ipynb

+7-7
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,13 @@
324324
"reconstructed_image = reconstruct_image(recovered_light_coeffs)\n",
325325
"reconstructed_image = np.transpose(reconstructed_image, (1, 0))\n",
326326
"plt.figure(figsize=(10, 20))\n",
327-
"ax = plt.subplot(\"131\")\n",
327+
"ax = plt.subplot(1, 3, 1)\n",
328328
"ax.axes.get_xaxis().set_visible(False)\n",
329329
"ax.axes.get_yaxis().set_visible(False)\n",
330330
"ax.grid(False)\n",
331331
"ax.set_title(\"Target\")\n",
332332
"_ = ax.imshow(target_transpose, vmin=0.0)\n",
333-
"ax = plt.subplot(\"132\")\n",
333+
"ax = plt.subplot(1, 3, 2)\n",
334334
"ax.axes.get_xaxis().set_visible(False)\n",
335335
"ax.axes.get_yaxis().set_visible(False)\n",
336336
"ax.grid(False)\n",
@@ -350,21 +350,21 @@
350350
" reconstructed_image = np.transpose(reconstructed_image, (1, 0))\n",
351351
" # Displays the target and prediction.\n",
352352
" plt.figure(figsize=(10, 20))\n",
353-
" ax = plt.subplot(\"131\")\n",
353+
" ax = plt.subplot(1, 3, 1)\n",
354354
" ax.axes.get_xaxis().set_visible(False)\n",
355355
" ax.axes.get_yaxis().set_visible(False)\n",
356356
" ax.grid(False)\n",
357357
" ax.set_title(\"Target\")\n",
358358
" img = ax.imshow(target_transpose, vmin=0.0)\n",
359-
" ax = plt.subplot(\"132\")\n",
359+
" ax = plt.subplot(1, 3, 2)\n",
360360
" ax.axes.get_xaxis().set_visible(False)\n",
361361
" ax.axes.get_yaxis().set_visible(False)\n",
362362
" ax.grid(False)\n",
363363
" ax.set_title(\"Prediction iteration \" + str(it))\n",
364364
" img = ax.imshow(reconstructed_image, vmin=0.0)\n",
365365
" # Shows the difference between groundtruth and prediction.\n",
366366
" vmax = np.maximum(np.amax(reconstructed_image), np.amax(target_transpose))\n",
367-
" ax = plt.subplot(\"133\")\n",
367+
" ax = plt.subplot(1, 3, 3)\n",
368368
" ax.axes.get_xaxis().set_visible(False)\n",
369369
" ax.axes.get_yaxis().set_visible(False)\n",
370370
" ax.grid(False)\n",
@@ -378,13 +378,13 @@
378378
"\n",
379379
"# Displays the groundtruth and predicted environment maps.\n",
380380
"plt.figure(figsize=(10, 20))\n",
381-
"ax = plt.subplot(\"121\")\n",
381+
"ax = plt.subplot(1, 2, 1)\n",
382382
"ax.axes.get_xaxis().set_visible(False)\n",
383383
"ax.axes.get_yaxis().set_visible(False)\n",
384384
"ax.grid(False)\n",
385385
"ax.set_title(\"Target light\")\n",
386386
"img = ax.imshow(reconstructed_light_function, vmin=0.0)\n",
387-
"ax = plt.subplot(\"122\")\n",
387+
"ax = plt.subplot(1, 2, 2)\n",
388388
"ax.axes.get_xaxis().set_visible(False)\n",
389389
"ax.axes.get_yaxis().set_visible(False)\n",
390390
"ax.grid(False)\n",

0 commit comments

Comments
 (0)