Fix matplotlib keyword arguments in accordance with deprecation of case-insensitive properties in 3.3

master
Daniel Dylewsky 2022-01-24 12:04:49 -05:00
parent 4ee8d9e4a2
commit 2c5b8a7b4d
28 changed files with 115 additions and 115 deletions

View File

@ -29,13 +29,13 @@
"a = a.reshape(-1, 1)\n",
"b = x*a + np.random.randn(*a.shape) # Add noise\n",
"\n",
"plt.plot(a, x*a, Color='k', LineWidth=2, label='True line') # True relationship\n",
"plt.plot(a, b, 'x', Color='r', MarkerSize = 10, label='Noisy data') # Noisy measurements\n",
"plt.plot(a, x*a, color='k', linewidth=2, label='True line') # True relationship\n",
"plt.plot(a, b, 'x', color='r', MarkerSize = 10, label='Noisy data') # Noisy measurements\n",
"\n",
"U, S, VT = np.linalg.svd(a,full_matrices=False)\n",
"xtilde = VT.T @ np.linalg.inv(np.diag(S)) @ U.T @ b # Least-square fit\n",
"\n",
"plt.plot(a,xtilde * a,'--',Color='b',LineWidth=4, label='Regression line')\n",
"plt.plot(a,xtilde * a,'--',color='b',linewidth=4, label='Regression line')\n",
"\n",
"plt.xlabel('a')\n",
"plt.ylabel('b')\n",

View File

@ -33,8 +33,8 @@
"U, S, VT = np.linalg.svd(A,full_matrices=0)\n",
"x = VT.T @ np.linalg.inv(np.diag(S)) @ U.T @ b\n",
"\n",
"plt.plot(b, Color='k', LineWidth=2, label='Heat Data') # True relationship\n",
"plt.plot(A@x, '-o', Color='r', LineWidth=1.5, MarkerSize=6, label='Regression')\n",
"plt.plot(b, color='k', linewidth=2, label='Heat Data') # True relationship\n",
"plt.plot(A@x, '-o', color='r', linewidth=1.5, markersize=6, label='Regression')\n",
"plt.legend()\n",
"plt.show()"
]

View File

@ -42,16 +42,16 @@
"fig = plt.figure()\n",
"ax1 = fig.add_subplot(121)\n",
"\n",
"plt.plot(b, Color='k', LineWidth=2, label='Housing Value') # True relationship\n",
"plt.plot(A@x, '-o', Color='r', LineWidth=1.5, MarkerSize=6, label='Regression')\n",
"plt.plot(b, color='k', linewidth=2, label='Housing Value') # True relationship\n",
"plt.plot(A@x, '-o', color='r', linewidth=1.5, markersize=6, label='Regression')\n",
"plt.xlabel('Neighborhood')\n",
"plt.ylabel('Median Home Value [$1k]')\n",
"plt.legend()\n",
"\n",
"ax2 = fig.add_subplot(122)\n",
"sort_ind = np.argsort(H[:,-1])\n",
"plt.plot(b[sort_ind], Color='k', LineWidth=2, label='Housing Value') # True relationship\n",
"plt.plot(A[sort_ind,:]@x, '-o', Color='r', LineWidth=1.5, MarkerSize=6, label='Regression')\n",
"plt.plot(b[sort_ind], color='k', linewidth=2, label='Housing Value') # True relationship\n",
"plt.plot(A[sort_ind,:]@x, '-o', color='r', linewidth=1.5, markersize=6, label='Regression')\n",
"plt.xlabel('Neighborhood')\n",
"plt.legend()\n",
"\n",

File diff suppressed because one or more lines are too long

View File

@ -96,7 +96,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.8.5"
}
},
"nbformat": 4,

View File

@ -214,8 +214,8 @@
"PCACoordsP1 = U[:,PCAmodes-np.ones_like(PCAmodes)].T @ P1\n",
"PCACoordsP2 = U[:,PCAmodes-np.ones_like(PCAmodes)].T @ P2\n",
"\n",
"plt.plot(PCACoordsP1[0,:],PCACoordsP1[1,:],'d',Color='k',label='Person 2')\n",
"plt.plot(PCACoordsP2[0,:],PCACoordsP2[1,:],'^',Color='r',label='Person 7')\n",
"plt.plot(PCACoordsP1[0,:],PCACoordsP1[1,:],'d',color='k',label='Person 2')\n",
"plt.plot(PCACoordsP2[0,:],PCACoordsP2[1,:],'^',color='r',label='Person 7')\n",
"\n",
"plt.legend()\n",
"plt.show()"

View File

@ -173,10 +173,10 @@
"\n",
"fig1,ax1 = plt.subplots(1)\n",
"\n",
"ax1.semilogy(S,'-o', color='k', LineWidth=2)\n",
"ax1.semilogy(np.diag(S[:(r+1)]),'o', color='r', LineWidth=2)\n",
"ax1.plot(np.array([-20, N+20]),np.array([cutoff, cutoff]),'--', color='r', LineWidth=2)\n",
"rect = patches.Rectangle((-5,20),100,200,LineWidth=2,LineStyle='--',FaceColor='none',EdgeColor='k')\n",
"ax1.semilogy(S,'-o', color='k', linewidth=2)\n",
"ax1.semilogy(np.diag(S[:(r+1)]),'o', color='r', linewidth=2)\n",
"ax1.plot(np.array([-20, N+20]),np.array([cutoff, cutoff]),'--', color='r', linewidth=2)\n",
"rect = patches.Rectangle((-5,20),100,200,linewidth=2,linestyle='--',facecolor='none',edgecolor='k')\n",
"ax1.add_patch(rect)\n",
"plt.xlim((-10,610))\n",
"plt.ylim((0.003,300))\n",
@ -185,22 +185,22 @@
"\n",
"fig2,ax2 = plt.subplots(1)\n",
"\n",
"ax2.semilogy(S,'-o', color='k', LineWidth=2)\n",
"ax2.semilogy(np.diag(S[:(r+1)]),'o', color='r', LineWidth=2)\n",
"ax2.plot(np.array([-20, N+20]),np.array([cutoff, cutoff]),'--', color='r', LineWidth=2)\n",
"ax2.semilogy(S,'-o', color='k', linewidth=2)\n",
"ax2.semilogy(np.diag(S[:(r+1)]),'o', color='r', linewidth=2)\n",
"ax2.plot(np.array([-20, N+20]),np.array([cutoff, cutoff]),'--', color='r', linewidth=2)\n",
"plt.xlim((-5,100))\n",
"plt.ylim((20,200))\n",
"ax2.grid()\n",
"plt.show()\n",
"\n",
"fig3,ax3 = plt.subplots(1)\n",
"ax3.plot(cdS,'-o',color='k',LineWidth=2)\n",
"ax3.plot(cdS[:(r90+1)],'o',color='b',LineWidth=2)\n",
"ax3.plot(cdS[:(r+1)],'o',color='r',LineWidth=2)\n",
"ax3.plot(cdS,'-o',color='k',linewidth=2)\n",
"ax3.plot(cdS[:(r90+1)],'o',color='b',linewidth=2)\n",
"ax3.plot(cdS[:(r+1)],'o',color='r',linewidth=2)\n",
"plt.xticks(np.array([0, 300, r90, 600]))\n",
"plt.yticks(np.array([0, 0.5, 0.9, 1]))\n",
"plt.xlim((-10,610))\n",
"ax3.plot(np.array([r90, r90, -10]),np.array([0, 0.9, 0.9]),'--',color='b',LineWidth=2)\n",
"ax3.plot(np.array([r90, r90, -10]),np.array([0, 0.9, 0.9]),'--',color='b',linewidth=2)\n",
"\n",
"ax3.grid()\n",
"plt.show()\n",

View File

@ -136,14 +136,14 @@
" [1,0,0],\n",
" [2/3,0,0]])\n",
"\n",
"plt.plot(S,'o-',color='k',LineWidth=2,label='SVD')\n",
"plt.plot(S,'o-',color='k',linewidth=2,label='SVD')\n",
"\n",
"Y = X\n",
"for q in range(1,6):\n",
" Y = X.T @ Y\n",
" Y = X @ Y\n",
" Uq, Sq, VTq = np.linalg.svd(Y,full_matrices=0)\n",
" plt.plot(Sq,'-o',color=tuple(color_list[2*q+1]),LineWidth=2,label='rSVD, q = '+str(q))\n",
" plt.plot(Sq,'-o',color=tuple(color_list[2*q+1]),linewidth=2,label='rSVD, q = '+str(q))\n",
"\n",
"plt.legend()\n",
"plt.show()"

View File

@ -77464,9 +77464,9 @@
"A1, A2, A3 = parafac(A,2)\n",
"\n",
"fig, axs = plt.subplots(3,1)\n",
"axs[0].plot(y,A1,LineWidth=2)\n",
"axs[1].plot(x,A2,LineWidth=2)\n",
"axs[2].plot(t,A3,LineWidth=2)\n",
"axs[0].plot(y,A1,linewidth=2)\n",
"axs[1].plot(x,A2,linewidth=2)\n",
"axs[2].plot(t,A3,linewidth=2)\n",
"plt.show()"
]
},
@ -77501,7 +77501,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.8.5"
}
},
"nbformat": 4,

View File

@ -40,10 +40,10 @@
"ff = f_interp(xf) \n",
"gf = g_interp(xf)\n",
"\n",
"plt.plot(xf[10:-10],ff[10:-10],color='k',LineWidth=2)\n",
"plt.plot(xf[10:-10],ff[10:-10],color='k',linewidth=2)\n",
"plt.plot(x[1:-2],f[1:-2],'o',color='b')\n",
"\n",
"plt.plot(xf[10:-10],gf[10:-10],color='k',LineWidth=2)\n",
"plt.plot(xf[10:-10],gf[10:-10],color='k',linewidth=2)\n",
"plt.plot(x[1:-2],g[1:-2],'o',color='r')\n",
"\n",
"plt.show()\n"

View File

@ -39,7 +39,7 @@
"f[2*nquart:3*nquart] = np.ones(nquart) - (4/n)*np.arange(0,nquart)\n",
"\n",
"fig, ax = plt.subplots()\n",
"ax.plot(x,f,'-',color='k',LineWidth=2)\n",
"ax.plot(x,f,'-',color='k',linewidth=2)\n",
"\n",
"# Compute Fourier series\n",
"name = \"Accent\"\n",
@ -99,13 +99,13 @@
"r = np.max(np.where(ERR > thresh))\n",
"\n",
"fig, axs = plt.subplots(2,1)\n",
"axs[0].semilogy(np.arange(kmax),A,color='k',LineWidth=2)\n",
"axs[0].semilogy(r,A[r],'o',color='b',MarkerSize=10)\n",
"axs[0].semilogy(np.arange(kmax),A,color='k',linewidth=2)\n",
"axs[0].semilogy(r,A[r],'o',color='b',markersize=10)\n",
"plt.sca(axs[0])\n",
"plt.title('Fourier Coefficients')\n",
"\n",
"axs[1].semilogy(np.arange(kmax),ERR,color='k',LineWidth=2)\n",
"axs[1].semilogy(r,ERR[r],'o',color='b',MarkerSize=10)\n",
"axs[1].semilogy(np.arange(kmax),ERR,color='k',linewidth=2)\n",
"axs[1].semilogy(r,ERR[r],'o',color='b',markersize=10)\n",
"plt.sca(axs[1])\n",
"plt.title('Error')\n",
"\n",

View File

@ -41,8 +41,8 @@
" Bk = np.sum(f * np.sin(2*np.pi*k*x/L)) * dx * 2 / L\n",
" fFS = fFS + Ak*np.cos(2*k*np.pi*x/L) + Bk*np.sin(2*k*np.pi*x/L)\n",
" \n",
"plt.plot(x,f,color='k',LineWidth=2)\n",
"plt.plot(x,fFS,'-',color='r',LineWidth=1.5)\n",
"plt.plot(x,f,color='k',linewidth=2)\n",
"plt.plot(x,fFS,'-',color='r',linewidth=1.5)\n",
"plt.show()"
]
},

View File

@ -41074,8 +41074,8 @@
"fFS = A0/2 * np.ones_like(f)\n",
"\n",
"fig,ax = plt.subplots()\n",
"plt.plot(x,f,color='k',LineWidth=2)\n",
"fFS_plot, = plt.plot([],[],color='r',LineWidth=2)\n",
"plt.plot(x,f,color='k',linewidth=2)\n",
"fFS_plot, = plt.plot([],[],color='r',linewidth=2)\n",
"\n",
"all_fFS = np.zeros((len(fFS),101))\n",
"all_fFS[:,0] = fFS\n",

View File

@ -70,20 +70,20 @@
"fig,axs = plt.subplots(3,1)\n",
"\n",
"plt.sca(axs[0])\n",
"plt.plot(t,f,color='r',LineWidth=1.5,label='Noisy')\n",
"plt.plot(t,f_clean,color='k',LineWidth=2,label='Clean')\n",
"plt.plot(t,f,color='r',linewidth=1.5,label='Noisy')\n",
"plt.plot(t,f_clean,color='k',linewidth=2,label='Clean')\n",
"plt.xlim(t[0],t[-1])\n",
"plt.legend()\n",
"\n",
"plt.sca(axs[1])\n",
"plt.plot(t,f_clean,color='k',LineWidth=1.5,label='Clean')\n",
"plt.plot(t,ffilt,color='b',LineWidth=2,label='Filtered')\n",
"plt.plot(t,f_clean,color='k',linewidth=1.5,label='Clean')\n",
"plt.plot(t,ffilt,color='b',linewidth=2,label='Filtered')\n",
"plt.xlim(t[0],t[-1])\n",
"plt.legend()\n",
"\n",
"plt.sca(axs[2])\n",
"plt.plot(freq[L],PSD[L],color='r',LineWidth=2,label='Noisy')\n",
"plt.plot(freq[L],PSDclean[L],color='b',LineWidth=1.5,label='Filtered')\n",
"plt.plot(freq[L],PSD[L],color='r',linewidth=2,label='Noisy')\n",
"plt.plot(freq[L],PSDclean[L],color='b',linewidth=1.5,label='Filtered')\n",
"plt.xlim(freq[L[0]],freq[L[-1]])\n",
"plt.legend()\n",
"\n",

View File

@ -68,9 +68,9 @@
],
"source": [
"## Plots\n",
"plt.plot(x,df.real,color='k',LineWidth=2,label='True Derivative')\n",
"plt.plot(x,dfFD.real,'--',color='b',LineWidth=1.5,label='Finite Diff.')\n",
"plt.plot(x,dfFFT.real,'--',color='r',LineWidth=1.5,label='FFT Derivative')\n",
"plt.plot(x,df.real,color='k',linewidth=2,label='True Derivative')\n",
"plt.plot(x,dfFD.real,'--',color='b',linewidth=1.5,label='Finite Diff.')\n",
"plt.plot(x,dfFFT.real,'--',color='r',linewidth=1.5,label='FFT Derivative')\n",
"plt.legend()\n",
"plt.show()"
]

View File

@ -53,13 +53,13 @@
"f22 = np.pad(f22, (2, 2), 'constant')\n",
"\n",
"fig,axs = plt.subplots(3,1)\n",
"axs[0].plot(x,f10,color='k',LineWidth=2)\n",
"axs[0].plot(x,f10,color='k',linewidth=2)\n",
"axs[0].set_xlim(-0.2,1.2)\n",
"axs[0].set_ylim(-1.75,1.75)\n",
"axs[1].plot(x,f21,color='k',LineWidth=2)\n",
"axs[1].plot(x,f21,color='k',linewidth=2)\n",
"axs[1].set_xlim(-0.2,1.2)\n",
"axs[1].set_ylim(-1.75,1.75)\n",
"axs[2].plot(x,f22,color='k',LineWidth=2)\n",
"axs[2].plot(x,f22,color='k',linewidth=2)\n",
"axs[2].set_xlim(-0.2,1.2)\n",
"axs[2].set_ylim(-1.75,1.75)\n",
"plt.show()"
@ -86,7 +86,7 @@
"source": [
"x = np.arange(-5,5,0.001)\n",
"fMexHat = (1-np.power(x,2)) * np.exp(-np.power(x,2)/2)\n",
"plt.plot(x,fMexHat,color='k',LineWidth=2)\n",
"plt.plot(x,fMexHat,color='k',linewidth=2)\n",
"plt.show()"
]
},

View File

@ -60,9 +60,9 @@
"source": [
"fig,axs = plt.subplots(2,2)\n",
"axs = axs.reshape(-1)\n",
"axs[0].plot(s_L1,color='b',LineWidth=1.5)\n",
"axs[0].plot(s_L1,color='b',linewidth=1.5)\n",
"axs[0].set_ylim(-0.2,0.2)\n",
"axs[1].plot(s_L2,color='r',LineWidth=1.5)\n",
"axs[1].plot(s_L2,color='r',linewidth=1.5)\n",
"axs[1].set_ylim(-0.2,0.2)\n",
"axs[2].hist(s_L1,bins=np.arange(-0.105,0.105,0.01),rwidth=0.9)\n",
"axs[3].hist(s_L2,bins=np.arange(-0.105,0.105,0.01),rwidth=0.9)\n",

View File

@ -112,23 +112,23 @@
"fig,axs = plt.subplots(2,2)\n",
"axs = axs.reshape(-1)\n",
"\n",
"axs[1].plot(freq[:L],PSD[:L],color='k',LineWidth=2)\n",
"axs[1].plot(freq[:L],PSD[:L],color='k',linewidth=2)\n",
"axs[1].set_xlim(0, 1024)\n",
"axs[1].set_ylim(0, 1200)\n",
"\n",
"axs[0].plot(t,x,color='k',LineWidth=2)\n",
"axs[0].plot(perm/n,y,color='r',marker='x',LineWidth=0,ms=12,mew=4)\n",
"axs[0].plot(t,x,color='k',linewidth=2)\n",
"axs[0].plot(perm/n,y,color='r',marker='x',linewidth=0,ms=12,mew=4)\n",
"axs[0].set_xlim(time_window[0],time_window[1])\n",
"axs[0].set_ylim(-2, 2)\n",
"\n",
"axs[2].plot(t,xrecon,color='r',LineWidth=2)\n",
"axs[2].plot(t,xrecon,color='r',linewidth=2)\n",
"axs[2].set_xlim(time_window[0],time_window[1])\n",
"axs[2].set_ylim(-2, 2)\n",
"\n",
"xtrecon = np.fft.fft(xrecon,n) # computes the (fast) discrete fourier transform\n",
"PSDrecon = xtrecon * np.conj(xtrecon)/n # Power spectrum (how much power in each freq)\n",
"\n",
"axs[3].plot(freq[:L],PSDrecon[:L],color='r',LineWidth=2)\n",
"axs[3].plot(freq[:L],PSDrecon[:L],color='r',linewidth=2)\n",
"axs[3].set_xlim(0, 1024)\n",
"axs[3].set_ylim(0, 1200)\n",
"\n",

View File

@ -80,9 +80,9 @@
"\n",
"plt.figure()\n",
"plt.plot(xf,y1,color='k',label='E_\\infty')\n",
"plt.plot(xf,y2,'--',color='k',LineWidth=2,label='E_1')\n",
"plt.plot(xf,y3,color='k',LineWidth=2,label='E_2')\n",
"plt.plot(x,y,'o',color='r',LineWidth=2)\n",
"plt.plot(xf,y2,'--',color='k',linewidth=2,label='E_1')\n",
"plt.plot(xf,y3,color='k',linewidth=2,label='E_2')\n",
"plt.plot(x,y,'o',color='r',linewidth=2)\n",
"\n",
"plt.ylim(0,4)\n",
"plt.legend()\n",
@ -142,9 +142,9 @@
"\n",
"plt.figure()\n",
"plt.plot(xf,y1,color='k',label='E_\\infty')\n",
"plt.plot(xf,y2,'--',color='k',LineWidth=2,label='E_1')\n",
"plt.plot(xf,y3,color='k',LineWidth=2,label='E_2')\n",
"plt.plot(x,y,'o',color='r',LineWidth=2)\n",
"plt.plot(xf,y2,'--',color='k',linewidth=2,label='E_1')\n",
"plt.plot(xf,y3,color='k',linewidth=2,label='E_2')\n",
"plt.plot(x,y,'o',color='r',linewidth=2)\n",
"\n",
"plt.ylim(0,4)\n",
"plt.legend()\n",

View File

@ -150,7 +150,7 @@
"fig,ax = plt.subplots(1,1,subplot_kw={'projection': '3d'})\n",
"ax.plot_surface(X, Y, Fquad,linewidth=0,color='k',alpha=0.3)\n",
"ax.scatter(x,y,f,'o',color='r',s=200)\n",
"ax.plot(x,y,f,':',color='k',LineWidth=3)\n",
"ax.plot(x,y,f,':',color='k',linewidth=3)\n",
"ax.contour(X, Y, Fquad, zdir='z', offset=ax.get_zlim()[0], cmap='gray')\n",
"ax.view_init(elev=40, azim=-140)\n",
"plt.show()"
@ -279,11 +279,11 @@
"source": [
"fig,ax = plt.subplots(1,1,subplot_kw={'projection': '3d'})\n",
"ax.plot_surface(X, Y, F-0.2,cmap='binary',alpha=0.5)\n",
"ax.plot(x1,y1,f1,'o',color='r',MarkerSize=10)\n",
"ax.plot(x1,y1,f1,'o',color='r',markersize=10)\n",
"ax.plot(x1,y1,f1,':',color='k')\n",
"ax.plot(x2,y2,f2,'o',color='m',MarkerSize=10)\n",
"ax.plot(x2,y2,f2,'o',color='m',markersize=10)\n",
"ax.plot(x2,y2,f2,':',color='k')\n",
"ax.plot(x3,y3,f3,'o',color='b',MarkerSize=10)\n",
"ax.plot(x3,y3,f3,'o',color='b',markersize=10)\n",
"ax.plot(x3,y3,f3,':',color='k')\n",
"ax.view_init(elev=40, azim=-100)\n",
"plt.show()"
@ -402,11 +402,11 @@
"source": [
"fig,ax = plt.subplots(1,1,subplot_kw={'projection': '3d'})\n",
"ax.plot_surface(X, Y, F-0.2,cmap='binary',alpha=0.5)\n",
"ax.plot(x1,y1,f1,'o',color='r',MarkerSize=10)\n",
"ax.plot(x1,y1,f1,'o',color='r',markersize=10)\n",
"ax.plot(x1,y1,f1,':',color='k')\n",
"ax.plot(x2,y2,f2,'o',color='m',MarkerSize=10)\n",
"ax.plot(x2,y2,f2,'o',color='m',markersize=10)\n",
"ax.plot(x2,y2,f2,':',color='k')\n",
"ax.plot(x3,y3,f3,'o',color='b',MarkerSize=10)\n",
"ax.plot(x3,y3,f3,'o',color='b',markersize=10)\n",
"ax.plot(x3,y3,f3,':',color='k')\n",
"ax.view_init(elev=40, azim=-100)\n",
"plt.show()"

View File

@ -45,9 +45,9 @@
"y3 = np.reshape(y3,-1)\n",
"x3 = np.tile(x,(1,5)).reshape(-1)\n",
"\n",
"plt.plot(x,y,color='k',LineWidth=2)\n",
"plt.plot(x,y,color='k',linewidth=2)\n",
"\n",
"rect = Rectangle((0.5,0.4), 0.9, 1.6,LineWidth=1,edgecolor='k',facecolor='grey',alpha=0.6) \n",
"rect = Rectangle((0.5,0.4), 0.9, 1.6,linewidth=1,edgecolor='k',facecolor='grey',alpha=0.6) \n",
"ax.add_patch(rect)\n",
"\n",
"plt.scatter(x2,y2,100,color='magenta',edgecolors='k')\n",

View File

@ -43,8 +43,8 @@
"ftrain = np.power(x1,2) # Train parabola x = [0,4]\n",
"ftest = np.power(x2,2) # Test parabola x = [4,8]\n",
"\n",
"plt.plot(x1,ftrain,color='r',LineWidth=2)\n",
"plt.plot(x2,ftest,color='b',LineWidth=2)\n",
"plt.plot(x1,ftrain,color='r',linewidth=2)\n",
"plt.plot(x2,ftest,color='b',linewidth=2)\n",
"plt.show()\n",
"M = 30 # number of model terms\n",
"Eni = np.zeros((100,M))\n",

View File

@ -64,10 +64,10 @@
"g3 = g3/np.trapz(g3,x)\n",
"\n",
"plt.figure()\n",
"plt.plot(x,f,LineWidth=2,label='f')\n",
"plt.plot(x,g1,LineWidth=2,label='g1')\n",
"plt.plot(x,g2,LineWidth=2,label='g2')\n",
"plt.plot(x,g3,LineWidth=2,label='g3')\n",
"plt.plot(x,f,linewidth=2,label='f')\n",
"plt.plot(x,g1,linewidth=2,label='g1')\n",
"plt.plot(x,g2,linewidth=2,label='g2')\n",
"plt.plot(x,g3,linewidth=2,label='g3')\n",
"plt.legend()\n",
"plt.show()"
]

View File

@ -211,7 +211,7 @@
"fig,axs = plt.subplots(2)\n",
"axs[0].plot(x[:n1],y[:n1],'ro')\n",
"axs[0].plot(x3[:n1],y3[:n1],'bo')\n",
"axs[0].plot(xsep,ysep,c='k',LineWidth=2)\n",
"axs[0].plot(xsep,ysep,c='k',linewidth=2)\n",
"axs[0].set_xlim(-2,4)\n",
"axs[0].set_ylim(-3,2)\n",
"\n",
@ -219,7 +219,7 @@
"\n",
"axs[1].plot(x[n1:],y[n1:],'ro')\n",
"axs[1].plot(x3[n1:],y3[n1:],'bo')\n",
"axs[1].plot(xsep,ysep,c='k',LineWidth=2)\n",
"axs[1].plot(xsep,ysep,c='k',linewidth=2)\n",
"axs[1].set_xlim(-2,4)\n",
"axs[1].set_ylim(-3,2)\n",
"\n",
@ -279,8 +279,8 @@
],
"source": [
"plt.bar(range(100),dn['leaves'])\n",
"plt.plot(np.array([0, 100]),np.array([50, 50]),'r:',LineWidth=2)\n",
"plt.plot(np.array([50.5, 50.5]),np.array([0, 100]),'r:',LineWidth=2)\n",
"plt.plot(np.array([0, 100]),np.array([50, 50]),'r:',linewidth=2)\n",
"plt.plot(np.array([50.5, 50.5]),np.array([0, 100]),'r:',linewidth=2)\n",
"\n",
"plt.show()"
]

View File

@ -143,8 +143,8 @@
],
"source": [
"plt.bar(range(100),dn['leaves'])\n",
"plt.plot(np.array([0, 100]),np.array([50, 50]),'r:',LineWidth=2)\n",
"plt.plot(np.array([50.5, 50.5]),np.array([0, 100]),'r:',LineWidth=2)\n",
"plt.plot(np.array([0, 100]),np.array([50, 50]),'r:',linewidth=2)\n",
"plt.plot(np.array([50.5, 50.5]),np.array([0, 100]),'r:',linewidth=2)\n",
"\n",
"plt.show()"
]

View File

@ -59,8 +59,8 @@
"GMModel = GaussianMixture(n_components=2).fit(dogcat)\n",
"AIC = GMModel.aic(dogcat)\n",
"\n",
"plt.plot(v[:80,1],v[:80,3],'ro',MarkerFaceColor=(0,1,0.2),MarkerEdgeColor='k',ms=12)\n",
"plt.plot(v[80:,1],v[80:,3],'bo',MarkerFaceColor=(0.9,0,1),MarkerEdgeColor='k',ms=12)\n",
"plt.plot(v[:80,1],v[:80,3],'ro',markerfacecolor=(0,1,0.2),markeredgecolor='k',ms=12)\n",
"plt.plot(v[80:,1],v[80:,3],'bo',markerfacecolor=(0.9,0,1),markeredgecolor='k',ms=12)\n",
"\n",
"x = np.linspace(-0.15, 0.25)\n",
"y = np.linspace(-0.25, 0.2)\n",

View File

@ -69,8 +69,8 @@
"fig,axs = plt.subplots(2)\n",
"axs[0].bar(range(40),test_class)\n",
"\n",
"axs[1].plot(v[:80,1],v[:80,3],'ro',MarkerFaceColor=(0,1,0.2),MarkerEdgeColor='k',ms=12)\n",
"axs[1].plot(v[80:,1],v[80:,3],'bo',MarkerFaceColor=(0.9,0,1),MarkerEdgeColor='k',ms=12)\n",
"axs[1].plot(v[:80,1],v[:80,3],'ro',markerfacecolor=(0,1,0.2),markeredgecolor='k',ms=12)\n",
"axs[1].plot(v[80:,1],v[80:,3],'bo',markerfacecolor=(0.9,0,1),markeredgecolor='k',ms=12)\n",
"\n",
"plt.show()"
]
@ -150,8 +150,8 @@
"fig,axs = plt.subplots(2)\n",
"axs[0].bar(range(40),test_class)\n",
"\n",
"axs[1].plot(v[:80,1],v[:80,3],'ro',MarkerFaceColor=(0,1,0.2),MarkerEdgeColor='k',ms=12)\n",
"axs[1].plot(v[80:,1],v[80:,3],'bo',MarkerFaceColor=(0.9,0,1),MarkerEdgeColor='k',ms=12)\n",
"axs[1].plot(v[:80,1],v[:80,3],'ro',markerfacecolor=(0,1,0.2),markeredgecolor='k',ms=12)\n",
"axs[1].plot(v[80:,1],v[80:,3],'bo',markerfacecolor=(0.9,0,1),markeredgecolor='k',ms=12)\n",
"\n",
"plt.show()"
]
@ -198,7 +198,7 @@
" E[jj] = 100*np.sum(np.abs(test_class-truth))/40\n",
" \n",
"plt.bar(range(100),E,color=(0.5,0.5,0.5))\n",
"plt.plot(range(100),np.mean(E)*np.ones(100),'r:',LineWidth=3)\n",
"plt.plot(range(100),np.mean(E)*np.ones(100),'r:',linewidth=3)\n",
"plt.show()"
]
},
@ -242,8 +242,8 @@
"plt.rcParams['figure.figsize'] = [12, 6]\n",
"fig,axs = plt.subplots(1,2)\n",
"for j in range(2):\n",
" axs[j].plot(v[:80,1],v[:80,3],'ro',MarkerFaceColor=(0,1,0.2),MarkerEdgeColor='k',ms=12)\n",
" axs[j].plot(v[80:,1],v[80:,3],'bo',MarkerFaceColor=(0.9,0,1),MarkerEdgeColor='k',ms=12)\n",
" axs[j].plot(v[:80,1],v[:80,3],'ro',markerfacecolor=(0,1,0.2),markeredgecolor='k',ms=12)\n",
" axs[j].plot(v[80:,1],v[80:,3],'bo',markerfacecolor=(0.9,0,1),markeredgecolor='k',ms=12)\n",
"\n",
"# Linear Discriminant\n",
"xtrain = np.concatenate((v[:60,np.array([1,3])],v[80:140,np.array([1,3])]))\n",
@ -259,7 +259,7 @@
"\n",
"\n",
"x = np.arange(-0.15,0.25,0.005)\n",
"axs[0].plot(x,-(L[0]*x+K)/L[1],'k',LineWidth=2)\n",
"axs[0].plot(x,-(L[0]*x+K)/L[1],'k',linewidth=2)\n",
"\n",
"\n",
"# Quadratic Discriminant\n",

View File

@ -48,8 +48,8 @@
"x2 = 1.5*np.random.randn(n1) + 1.5\n",
"y2 = 1.2*np.random.randn(n1) - np.power(x2-1.5,2) + 7\n",
"\n",
"plt.plot(x1,y1,'ro',MarkerFaceColor=(0,1,0.2),MarkerEdgeColor='k',ms=12)\n",
"plt.plot(x2,y2,'bo',MarkerFaceColor=(0.9,0,1),MarkerEdgeColor='k',ms=12)\n",
"plt.plot(x1,y1,'ro',markerfacecolor=(0,1,0.2),markeredgecolor='k',ms=12)\n",
"plt.plot(x2,y2,'bo',markerfacecolor=(0.9,0,1),markeredgecolor='k',ms=12)\n",
"\n",
"plt.show()"
]
@ -79,8 +79,8 @@
"fig = plt.figure()\n",
"ax = plt.axes(projection='3d')\n",
"\n",
"ax.plot(x1,y1,z1,'ro',MarkerFaceColor=(0,1,0.2),MarkerEdgeColor='k',ms=12)\n",
"ax.plot(x2,y2,z2,'bo',MarkerFaceColor=(0.9,0,1),MarkerEdgeColor='k',ms=12)\n",
"ax.plot(x1,y1,z1,'ro',markerfacecolor=(0,1,0.2),markeredgecolor='k',ms=12)\n",
"ax.plot(x2,y2,z2,'bo',markerfacecolor=(0.9,0,1),markeredgecolor='k',ms=12)\n",
"\n",
"ax.view_init(20, -135)\n",
"\n",
@ -120,8 +120,8 @@
"ax = plt.axes(projection='3d')\n",
"ax.view_init(20, -135)\n",
"\n",
"ax.plot(xr,yr,zr+40,'ro',MarkerFaceColor=(0,1,0.2),MarkerEdgeColor='k',ms=12)\n",
"ax.plot(x5,y5,z5+40,'bo',MarkerFaceColor=(0.9,0,1),MarkerEdgeColor='k',ms=12)\n",
"ax.plot(xr,yr,zr+40,'ro',markerfacecolor=(0,1,0.2),markeredgecolor='k',ms=12)\n",
"ax.plot(x5,y5,z5+40,'bo',markerfacecolor=(0.9,0,1),markeredgecolor='k',ms=12)\n",
"\n",
"\n",
"x = np.arange(-10,10.5,0.5)\n",
@ -131,8 +131,8 @@
"\n",
"ax.plot_surface(X, Y, F3, cmap='gray',linewidth=0, antialiased=True,alpha=0.2)\n",
"\n",
"ax.plot(xr,yr,np.zeros(*xr.shape),'ro',MarkerFaceColor=(179/255,1,179/255),MarkerEdgeColor='k',ms=12)\n",
"ax.plot(x5,y5,np.zeros(*x5.shape),'bo',MarkerFaceColor=(240/255,194/255,224/255),MarkerEdgeColor='k',ms=12)\n",
"ax.plot(xr,yr,np.zeros(*xr.shape),'ro',markerfacecolor=(179/255,1,179/255),markeredgecolor='k',ms=12)\n",
"ax.plot(x5,y5,np.zeros(*x5.shape),'bo',markerfacecolor=(240/255,194/255,224/255),markeredgecolor='k',ms=12)\n",
"\n",
"theta = np.linspace(0,2*np.pi,100)\n",
"xrr = np.sqrt(14)*np.cos(theta)\n",