From fb98536ac297a06fea889060380f17fa1946e0b7 Mon Sep 17 00:00:00 2001 From: yangyonggit Date: Sat, 6 May 2023 11:37:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?"=E6=B7=BB=E5=8A=A0plt.show()=E7=9A=84?= =?UTF-8?q?=E8=B0=83=E7=94=A8=EF=BC=8C=E5=8F=AF=E4=BB=A5=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=9C=8B=E5=88=B0=E7=BB=93=E6=9E=9C=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Book3_Ch02_Python_Codes/Bk3_Ch2_10.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Book3_Ch02_Python_Codes/Bk3_Ch2_10.py b/Book3_Ch02_Python_Codes/Bk3_Ch2_10.py index e9f08e9..5ab0f24 100644 --- a/Book3_Ch02_Python_Codes/Bk3_Ch2_10.py +++ b/Book3_Ch02_Python_Codes/Bk3_Ch2_10.py @@ -120,4 +120,6 @@ yticklabels=np.arange(1,m+1), xticklabels=np.arange(1,n+1)) ax.set_aspect("equal") plt.title('$C$') -plt.yticks(rotation=0) \ No newline at end of file +plt.yticks(rotation=0) + +plt.show() From 4a5b3b20e0dfcfe22514352b1de916187a372c73 Mon Sep 17 00:00:00 2001 From: yangyonggit Date: Wed, 10 May 2023 15:17:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?-fix=20Bk3=5FCh16=5F01=5FC=20=E5=B9=B3?= =?UTF-8?q?=E9=9D=A2=E5=A1=AB=E5=85=85=E7=AD=89=E9=AB=98=E7=BA=BF=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=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 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Book3_Ch16_Python_Codes/Bk3_Ch16_01.py b/Book3_Ch16_Python_Codes/Bk3_Ch16_01.py index f187c18..991fae6 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') @@ -155,19 +155,19 @@ def plot_surface(xx, yy, surface, title_txt): ax.view_init(azim=-135, elev=30) ax.grid(False) - plt.show() + # plt.show() - 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()