From d7cda9567f1002151807434fd442cf4b172517e7 Mon Sep 17 00:00:00 2001 From: Jan Benda Date: Tue, 14 Jan 2020 23:45:18 +0100 Subject: [PATCH] [simulations] updated plots --- plotstyle.py | 2 +- simulations/lecture/normaldata.py | 6 +++--- simulations/lecture/randomnumbers.py | 12 ++++-------- simulations/lecture/staticnonlinearity.py | 8 ++++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/plotstyle.py b/plotstyle.py index 8799339..328565a 100644 --- a/plotstyle.py +++ b/plotstyle.py @@ -34,7 +34,7 @@ minorline = {'linestyle': '-', 'linewidth': lwthin} largemarker = {'marker': 'o', 'markersize': 9, 'markeredgecolor': colors['white'], 'markeredgewidth': 1} smallmarker = {'marker': 'o', 'markersize': 6, 'markeredgecolor': colors['white'], 'markeredgewidth': 1} largelinepoints = {'linestyle': '-', 'linewidth': lwthick, 'marker': 'o', 'markersize': 10, 'markeredgecolor': colors['white'], 'markeredgewidth': 1} -smalllinepoints = {'linestyle': '-', 'linewidth': lwthin, 'marker': 'o', 'markersize': 7, 'markeredgecolor': colors['white'], 'markeredgewidth': 1} +smalllinepoints = {'linestyle': '-', 'linewidth': 1.4, 'marker': 'o', 'markersize': 7, 'markeredgecolor': colors['white'], 'markeredgewidth': 1} filllw = 1 fillec = colors['white'] fillalpha = 0.4 diff --git a/simulations/lecture/normaldata.py b/simulations/lecture/normaldata.py index 4721ec8..b259a3b 100644 --- a/simulations/lecture/normaldata.py +++ b/simulations/lecture/normaldata.py @@ -19,7 +19,7 @@ if __name__ == "__main__": spec = gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[3, 1], wspace=0.08, **adjust_fs(fig, left=6.0)) ax1 = fig.add_subplot(spec[0, 0]) - ax1.scatter(indices, data, c=colors['blue'], edgecolor='white', s=50) + ax1.plot(indices, data, **psAm) ax1.set_xlabel('Index') ax1.set_ylabel('Weight', 'kg') ax1.set_xlim(-10, 310) @@ -29,10 +29,10 @@ if __name__ == "__main__": ax2 = fig.add_subplot(spec[0, 1]) xx = np.arange(0.0, 350.0, 0.5) yy = st.norm.pdf(xx, mu, sigma) - ax2.plot(yy, xx, color=colors['red'], lw=2) + ax2.plot(yy, xx, **lsBm) bw = 20.0 h, b = np.histogram(data, np.arange(0, 401, bw)) - ax2.barh(b[:-1], h/np.sum(h)/(b[1]-b[0]), fc=colors['yellow'], height=bar_fac*bw, align='edge') + ax2.barh(b[:-1], h/np.sum(h)/(b[1]-b[0]), height=bar_fac*bw, align='edge', **fsC) ax2.set_xlabel('Pdf', '1/kg') ax2.set_xlim(0, 0.012) ax2.set_xticks([0, 0.005, 0.01]) diff --git a/simulations/lecture/randomnumbers.py b/simulations/lecture/randomnumbers.py index 785e032..cf85f39 100644 --- a/simulations/lecture/randomnumbers.py +++ b/simulations/lecture/randomnumbers.py @@ -24,32 +24,28 @@ if __name__ == "__main__": spec = gridspec.GridSpec(nrows=2, ncols=2, **adjust_fs(fig)) ax = fig.add_subplot(spec[0, 0]) - ax.plot(indices, x1, c=colors['blue'], lw=1, zorder=10) - ax.scatter(indices, x1, c=colors['blue'], edgecolor='white', s=50, zorder=20) + ax.plot(indices, x1, zorder=10, **lpsAm) ax.set_xlabel('Index') ax.set_ylabel('Random number') ax.set_xlim(-1.0, n+1.0) ax.set_ylim(-0.05, 1.05) ax = fig.add_subplot(spec[0, 1]) - ax.plot(indices, x2, c=colors['blue'], lw=1, zorder=10) - ax.scatter(indices, x2, c=colors['blue'], edgecolor='white', s=50, zorder=20) + ax.plot(indices, x2, zorder=10, **lpsAm) ax.set_xlabel('Index') ax.set_ylabel('Random number') ax.set_xlim(-1.0, n+1.0) ax.set_ylim(-0.05, 1.05) ax = fig.add_subplot(spec[1, 1]) - ax.plot(indices, x3, c=colors['blue'], lw=1, zorder=10) - ax.scatter(indices, x3, c=colors['blue'], edgecolor='white', s=50, zorder=20) + ax.plot(indices, x3, zorder=10, **lpsAm) ax.set_xlabel('Index') ax.set_ylabel('Random number') ax.set_xlim(-1.0, n+1.0) ax.set_ylim(-0.05, 1.05) ax = fig.add_subplot(spec[1, 0]) - ax.plot(lags, corrs, c=colors['red'], lw=1, zorder=10) - ax.scatter(lags, corrs, c=colors['red'], edgecolor='white', s=50, zorder=20) + ax.plot(lags, corrs, zorder=10, **lpsBm) ax.set_xlabel('Lag') ax.set_ylabel('Serial correlation') ax.set_xlim(-maxl-0.5, maxl+0.5) diff --git a/simulations/lecture/staticnonlinearity.py b/simulations/lecture/staticnonlinearity.py index 8b36fe7..6cfde3d 100644 --- a/simulations/lecture/staticnonlinearity.py +++ b/simulations/lecture/staticnonlinearity.py @@ -23,8 +23,8 @@ if __name__ == "__main__": fig = plt.figure() spec = gridspec.GridSpec(nrows=1, ncols=2, **adjust_fs(fig, left=4.5)) ax1 = fig.add_subplot(spec[0, 0]) - ax1.plot(xx, yy, **ls['A1']) - ax1.scatter(x, y, c=colors['blue'], edgecolor='white', s=50) + ax1.plot(x, y, **psAm) + ax1.plot(xx, yy, **lsB) ax1.set_xlabel('Hair deflection', 'nm') ax1.set_ylabel('Conductance', 'nS') ax1.set_xlim(-20, 20) @@ -35,10 +35,10 @@ if __name__ == "__main__": ax2 = fig.add_subplot(spec[0, 1]) xg = np.linspace(-3.0, 3.01, 200) yg = st.norm.pdf(xg, 0.0, sigma) - ax2.plot(xg, yg, **ls['A1']) + ax2.plot(xg, yg, **lsB) bw = 0.25 h, b = np.histogram(y-boltzmann(x, x0, k), np.arange(-3.0, 3.01, bw)) - ax2.bar(b[:-1], h/np.sum(h)/(b[1]-b[0]), fc=colors['yellow'], width=bar_fac*bw, align='edge') + ax2.bar(b[:-1], h/np.sum(h)/(b[1]-b[0]), width=bar_fac*bw, align='edge', **fsC) ax2.set_xlabel('Residuals', 'nS') ax2.set_ylabel('Pdf', '1/nS') ax2.set_xlim(-2.5, 2.5)