Skip to content

Commit

Permalink
Update matplotlib.figure.Figure.add_subplot call to take integer argu…
Browse files Browse the repository at this point in the history
…ments.

PiperOrigin-RevId: 487816510
  • Loading branch information
tensorflower-gardener authored and copybara-github committed Nov 11, 2022
1 parent ed5c9ac commit c0d52ca
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions tensorflow_graphics/notebooks/intrinsics_optimization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,13 @@
"source": [
"def plot_optimization_step(observation, prediction):\n",
" plt.figure(figsize=(20, 10))\n",
" ax = plt.subplot(\"131\")\n",
" ax = plt.subplot(1, 3, 1)\n",
" ax.set_title(\"Observation\")\n",
" _ = ax.imshow(observation)\n",
" ax = plt.subplot(\"132\")\n",
" ax = plt.subplot(1, 3, 2)\n",
" ax.set_title(\"Prediction using estimated intrinsics\")\n",
" _ = ax.imshow(prediction)\n",
" ax = plt.subplot(\"133\")\n",
" ax = plt.subplot(1, 3, 3)\n",
" ax.set_title(\"Difference image\")\n",
" _ = ax.imshow(np.abs(observation - prediction))\n",
" plt.show()\n",
Expand Down
6 changes: 3 additions & 3 deletions tensorflow_graphics/notebooks/reflectance.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
"\n",
"# Diffuse\n",
"radiance_lambertian = np.transpose(radiance_lambertian, (1, 0, 2))\n",
"ax = plt.subplot(\"131\")\n",
"ax = plt.subplot(1, 3, 1)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
Expand All @@ -266,7 +266,7 @@
"\n",
"# Specular\n",
"radiance_phong = np.transpose(radiance_phong, (1, 0, 2))\n",
"ax = plt.subplot(\"132\")\n",
"ax = plt.subplot(1, 3, 2)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
Expand All @@ -275,7 +275,7 @@
"\n",
"# Diffuse + specular\n",
"radiance = np.transpose(radiance, (1, 0, 2))\n",
"ax = plt.subplot(\"133\")\n",
"ax = plt.subplot(1, 3, 3)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,19 @@
" 1.0)\n",
"# Plots results.\n",
"plt.figure(figsize=(10, 10))\n",
"ax = plt.subplot(\"131\")\n",
"ax = plt.subplot(1, 3, 1)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
"ax.set_title(\"Original lighting function\")\n",
"_ = ax.imshow(sampled_light_function, vmin=vmin, vmax=vmax)\n",
"ax = plt.subplot(\"132\")\n",
"ax = plt.subplot(1, 3, 2)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
"ax.set_title(\"Spherical Harmonics approximation\")\n",
"_ = ax.imshow(reconstructed_light_function, vmin=vmin, vmax=vmax)\n",
"ax = plt.subplot(\"133\")\n",
"ax = plt.subplot(1, 3, 3)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
Expand Down Expand Up @@ -347,19 +347,19 @@
" np.amax(np.maximum(sampled_brdf, reconstructed_brdf)), 1.0 / np.pi)\n",
"# Plots results.\n",
"plt.figure(figsize=(10, 10))\n",
"ax = plt.subplot(\"131\")\n",
"ax = plt.subplot(1, 3, 1)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
"ax.set_title(\"Original reflectance function\")\n",
"_ = ax.imshow(sampled_brdf, vmin=vmin, vmax=vmax)\n",
"ax = plt.subplot(\"132\")\n",
"ax = plt.subplot(1, 3, 2)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
"ax.set_title(\"Zonal Harmonics approximation\")\n",
"_ = ax.imshow(reconstructed_brdf, vmin=vmin, vmax=vmax)\n",
"ax = plt.subplot(\"133\")\n",
"ax = plt.subplot(1, 3, 3)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
Expand Down Expand Up @@ -438,13 +438,13 @@
" vector.dot(sh_coefficients, rotated_zonal_coefficients))\n",
"\n",
"plt.figure(figsize=(10, 10))\n",
"ax = plt.subplot(\"121\")\n",
"ax = plt.subplot(1, 2, 1)\n",
"ax.set_title(\"Zonal SH\")\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
"_ = ax.imshow(reconstructed_brdf)\n",
"ax = plt.subplot(\"122\")\n",
"ax = plt.subplot(1, 2, 2)\n",
"ax.set_title(\"Rotated version\")\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
Expand Down Expand Up @@ -573,13 +573,13 @@
"gt = np.transpose(gt, (1, 0))\n",
"\n",
"plt.figure(figsize=(10, 20))\n",
"ax = plt.subplot(\"121\")\n",
"ax = plt.subplot(1, 2, 1)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
"ax.set_title(\"SH light and SH BRDF\")\n",
"_ = ax.imshow(sh_integration, vmin=0.0)\n",
"ax = plt.subplot(\"122\")\n",
"ax = plt.subplot(1, 2, 2)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@
"reconstructed_image = reconstruct_image(recovered_light_coeffs)\n",
"reconstructed_image = np.transpose(reconstructed_image, (1, 0))\n",
"plt.figure(figsize=(10, 20))\n",
"ax = plt.subplot(\"131\")\n",
"ax = plt.subplot(1, 3, 1)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
"ax.set_title(\"Target\")\n",
"_ = ax.imshow(target_transpose, vmin=0.0)\n",
"ax = plt.subplot(\"132\")\n",
"ax = plt.subplot(1, 3, 2)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
Expand All @@ -350,21 +350,21 @@
" reconstructed_image = np.transpose(reconstructed_image, (1, 0))\n",
" # Displays the target and prediction.\n",
" plt.figure(figsize=(10, 20))\n",
" ax = plt.subplot(\"131\")\n",
" ax = plt.subplot(1, 3, 1)\n",
" ax.axes.get_xaxis().set_visible(False)\n",
" ax.axes.get_yaxis().set_visible(False)\n",
" ax.grid(False)\n",
" ax.set_title(\"Target\")\n",
" img = ax.imshow(target_transpose, vmin=0.0)\n",
" ax = plt.subplot(\"132\")\n",
" ax = plt.subplot(1, 3, 2)\n",
" ax.axes.get_xaxis().set_visible(False)\n",
" ax.axes.get_yaxis().set_visible(False)\n",
" ax.grid(False)\n",
" ax.set_title(\"Prediction iteration \" + str(it))\n",
" img = ax.imshow(reconstructed_image, vmin=0.0)\n",
" # Shows the difference between groundtruth and prediction.\n",
" vmax = np.maximum(np.amax(reconstructed_image), np.amax(target_transpose))\n",
" ax = plt.subplot(\"133\")\n",
" ax = plt.subplot(1, 3, 3)\n",
" ax.axes.get_xaxis().set_visible(False)\n",
" ax.axes.get_yaxis().set_visible(False)\n",
" ax.grid(False)\n",
Expand All @@ -378,13 +378,13 @@
"\n",
"# Displays the groundtruth and predicted environment maps.\n",
"plt.figure(figsize=(10, 20))\n",
"ax = plt.subplot(\"121\")\n",
"ax = plt.subplot(1, 2, 1)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
"ax.set_title(\"Target light\")\n",
"img = ax.imshow(reconstructed_light_function, vmin=0.0)\n",
"ax = plt.subplot(\"122\")\n",
"ax = plt.subplot(1, 2, 2)\n",
"ax.axes.get_xaxis().set_visible(False)\n",
"ax.axes.get_yaxis().set_visible(False)\n",
"ax.grid(False)\n",
Expand Down

0 comments on commit c0d52ca

Please sign in to comment.