From 43246d77f5e23039961395b92edba1d5e5310b64 Mon Sep 17 00:00:00 2001 From: yangyonggit Date: Wed, 10 May 2023 15:44:01 +0800 Subject: [PATCH] =?UTF-8?q?-fix=20Bk3=5FCh16=5F01=5FC=E5=B9=B3=E9=9D=A2?= =?UTF-8?q?=E5=A1=AB=E5=85=85=E7=AD=89=E9=AB=98=E7=BA=BF=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Book3_Ch16_Python_Codes/Bk3_Ch16_01.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Book3_Ch16_Python_Codes/Bk3_Ch16_01.py b/Book3_Ch16_Python_Codes/Bk3_Ch16_01.py index f187c18..81084b4 100644 --- a/Book3_Ch16_Python_Codes/Bk3_Ch16_01.py +++ b/Book3_Ch16_Python_Codes/Bk3_Ch16_01.py @@ -142,7 +142,7 @@ def plot_surface(xx, yy, surface, title_txt): colorbar = ax.contour(xx,yy, surface,20, cmap = 'RdYlBu_r') - # fig.colorbar(colorbar, ax=ax) + fig.colorbar(colorbar, ax=ax) ax.set_proj_type('ortho') @@ -154,20 +154,19 @@ def plot_surface(xx, yy, surface, title_txt): ax.view_init(azim=-135, elev=30) - ax.grid(False) - plt.show() + ax.grid(False) - ax = fig.add_subplot(1, 2, 2) + ax2 = fig.add_subplot(1, 2, 2) - colorbar = ax.contourf(xx,yy, surface, 20, cmap='RdYlBu_r') + colorbar = ax2.contourf(xx,yy, surface, 20, cmap='RdYlBu_r') - # fig.colorbar(colorbar, ax=ax) + fig.colorbar(colorbar, ax=ax2) - ax.set_xlim(xx.min(), xx.max()) - ax.set_ylim(yy.min(), yy.max()) + ax2.set_xlim(xx.min(), xx.max()) + ax2.set_ylim(yy.min(), yy.max()) - ax.set_xlabel('$x_1$') - ax.set_ylabel('$x_2$') + ax2.set_xlabel('$x_1$') + ax2.set_ylabel('$x_2$') plt.gca().set_aspect('equal', adjustable='box') plt.show()