diff --git a/Book4_Ch08_Python_Codes/Bk4_Ch8_01.py b/Book4_Ch08_Python_Codes/Bk4_Ch8_01.py index be711ae..f5a6856 100644 --- a/Book4_Ch08_Python_Codes/Bk4_Ch8_01.py +++ b/Book4_Ch08_Python_Codes/Bk4_Ch8_01.py @@ -71,3 +71,5 @@ def plot_shape(X,copy = False): ax.spines['left'].set_visible(False) plt.xlabel('$x_1$') plt.ylabel('$x_2$') + +plt.show() \ No newline at end of file diff --git a/Book4_Ch08_Python_Codes/Bk4_Ch8_02.py b/Book4_Ch08_Python_Codes/Bk4_Ch8_02.py index 1a83b33..92d3ab0 100644 --- a/Book4_Ch08_Python_Codes/Bk4_Ch8_02.py +++ b/Book4_Ch08_Python_Codes/Bk4_Ch8_02.py @@ -27,6 +27,8 @@ def plot_shape(X,copy = False): markeredgecolor = edge_color*0.5, linestyle = 'None') + + X = np.array([[1,1], [0,-1], [-1,-1], @@ -35,12 +37,11 @@ def plot_shape(X,copy = False): # visualizations thetas = np.linspace(30, 330, num=11) +fig, ax = plt.subplots() -for theta in thetas: +for theta in thetas: - fig, ax = plt.subplots() - - theta = theta/180*np.pi; + theta = theta/180*np.pi # rotation R = np.array([[np.cos(theta), np.sin(theta)], [-np.sin(theta), np.cos(theta)]]) @@ -66,3 +67,5 @@ def plot_shape(X,copy = False): ax.spines['left'].set_visible(False) plt.xlabel('$x_1$') plt.ylabel('$x_2$') + +plt.show()