[plotstyle] overwrite Axes constructer for show_spines

This commit is contained in:
2020-01-04 19:06:52 +01:00
parent c49047fa67
commit b4cfd0d181
9 changed files with 27 additions and 39 deletions

View File

@@ -21,8 +21,6 @@ def plot_data(ax, x, y, c):
ax.plot(xx, c*xx**3.0, color=colors['red'], lw=2, zorder=5)
for cc in [0.25*c, 0.5*c, 2.0*c, 4.0*c]:
ax.plot(xx, cc*xx**3.0, color=colors['orange'], lw=1.5, zorder=5)
show_spines(ax, 'lb')
ax.set_xlabel('Size x', 'm')
ax.set_ylabel('Weight y', 'kg')
ax.set_xlim(2, 4)
@@ -32,7 +30,6 @@ def plot_data(ax, x, y, c):
def plot_data_errors(ax, x, y, c):
show_spines(ax, 'lb')
ax.set_xlabel('Size x', 'm')
#ax.set_ylabel('Weight y', 'kg')
ax.set_xlim(2, 4)
@@ -56,7 +53,6 @@ def plot_data_errors(ax, x, y, c):
ax.plot(xx, yy, color=colors['orange'], lw=2, zorder=5)
def plot_error_hist(ax, x, y, c):
show_spines(ax, 'lb')
ax.set_xlabel('Squared error')
ax.set_ylabel('Frequency')
bins = np.arange(0.0, 1250.0, 100)

View File

@@ -21,8 +21,6 @@ if __name__ == "__main__":
ax.plot(xx, c*xx**3.0, color=colors['red'], lw=3, zorder=5)
for cc in [0.25*c, 0.5*c, 2.0*c, 4.0*c]:
ax.plot(xx, cc*xx**3.0, color=colors['orange'], lw=2, zorder=5)
show_spines(ax, 'lb')
ax.set_xlabel('Size x', 'm')
ax.set_ylabel('Weight y', 'kg')
ax.set_xlim(2, 4)

View File

@@ -48,9 +48,6 @@ def plot_mse(ax, x, y, c, cs):
xytext=(cs[i]+0.3, ms[i]+200), textcoords='data', ha='left',
arrowprops=dict(arrowstyle="->", relpos=(0.0,0.0),
connectionstyle="angle3,angleA=10,angleB=70") )
show_spines(ax, 'lb')
ax.set_xlabel('c')
ax.set_ylabel('Mean squared error')
ax.set_xlim(0, 10)
@@ -60,8 +57,6 @@ def plot_mse(ax, x, y, c, cs):
def plot_descent(ax, cs, mses):
ax.plot(np.arange(len(mses))+1, mses, '-o', c=colors['red'], mew=0, ms=8)
show_spines(ax, 'lb')
ax.set_xlabel('Iteration')
#ax.set_ylabel('Mean squared error')
ax.set_xlim(0, 10.5)

View File

@@ -15,7 +15,6 @@ def create_data():
def plot_data(ax, x, y):
ax.scatter(x, y, marker='o', color=colors['blue'], s=40)
show_spines(ax, 'lb')
ax.set_xlabel('Input x')
ax.set_ylabel('Output y')
ax.set_xlim(0, 120)
@@ -29,7 +28,6 @@ def plot_data_slopes(ax, x, y, m, n):
xx = np.asarray([2, 118])
for i in np.linspace(0.3*m, 2.0*m, 5):
ax.plot(xx, i*xx+n, color=colors['red'], lw=2)
show_spines(ax, 'lb')
ax.set_xlabel('Input x')
#ax.set_ylabel('Output y')
ax.set_xlim(0, 120)
@@ -43,7 +41,6 @@ def plot_data_intercepts(ax, x, y, m, n):
xx = np.asarray([2, 118])
for i in np.linspace(n-1*n, n+1*n, 5):
ax.plot(xx, m*xx + i, color=colors['red'], lw=2)
show_spines(ax, 'lb')
ax.set_xlabel('Input x')
#ax.set_ylabel('Output y')
ax.set_xlim(0, 120)

View File

@@ -14,7 +14,6 @@ def create_data():
def plot_data(ax, x, y, m, n):
show_spines(ax, 'lb')
ax.set_xlabel('Input x')
ax.set_ylabel('Output y')
ax.set_xlim(0, 120)
@@ -38,7 +37,6 @@ def plot_data(ax, x, y, m, n):
def plot_error_hist(ax, x, y, m, n):
show_spines(ax, 'lb')
ax.set_xlabel('Squared error')
ax.set_ylabel('Frequency')
bins = np.arange(0.0, 602.0, 50.0)