diff --git a/debugging/lecture/debugging-chapter.tex b/debugging/lecture/debugging-chapter.tex index 75472c9..caf8c35 100644 --- a/debugging/lecture/debugging-chapter.tex +++ b/debugging/lecture/debugging-chapter.tex @@ -1,4 +1,3 @@ - \documentclass[12pt]{book} \input{../../header} diff --git a/header.tex b/header.tex index 0369ca7..6511f0a 100644 --- a/header.tex +++ b/header.tex @@ -21,7 +21,7 @@ \usepackage{pslatex} % nice font for pdf file %%%% layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage[left=25mm,right=25mm,top=20mm,bottom=30mm]{geometry} +\usepackage[a4paper,left=25mm,right=25mm,top=20mm,bottom=30mm]{geometry} \usepackage[within=chapter]{newfloat} \usepackage{tocloft} \setlength{\cftfigindent}{1.2em} diff --git a/plotstyle.py b/plotstyle.py index fe45614..511e282 100644 --- a/plotstyle.py +++ b/plotstyle.py @@ -1,7 +1,11 @@ import matplotlib as mpl import matplotlib.pyplot as plt -xkcd_style = False +xkcd_style = True + +# default size of figure: +figure_width = 15.0 # cm, should be set according to \textwidth in the latex document +figure_height = 6.0 # cm, for a 1 x 2 figure # colors: colors = { @@ -133,6 +137,13 @@ else: mpl.rcParams['xtick.major.size'] = 2.5 mpl.rcParams['ytick.major.size'] = 2.5 mpl.rcParams['legend.fontsize'] = 'x-small' +mpl.rcParams['figure.figsize'] = cm_size(figure_width, figure_height) +mpl.rcParams['figure.subplot.left'] = 0.11 +mpl.rcParams['figure.subplot.right'] = 0.99 +mpl.rcParams['figure.subplot.bottom'] = 0.23 +mpl.rcParams['figure.subplot.top'] = 0.96 +mpl.rcParams['figure.subplot.wspace'] = 0.4 +mpl.rcParams['figure.subplot.hspace'] = 0.2 mpl.rcParams['figure.facecolor'] = 'white' #mpl.rcParams['axes.spines.left'] = True # newer matplotlib only #mpl.rcParams['axes.spines.bottom'] = True diff --git a/simulations/code/randomnumbers.m b/simulations/code/randomnumbers.m index 22432b3..6fa3525 100644 --- a/simulations/code/randomnumbers.m +++ b/simulations/code/randomnumbers.m @@ -9,7 +9,7 @@ for k = 1:3 rand(1, n) end -% serial corraltion at lag 1: +% serial correlation at lag 1: n = 10000; x = rand(n, 1); r1 = corr(x(1:end-1), x(2:end)); diff --git a/simulations/lecture/normaldata.py b/simulations/lecture/normaldata.py index e3cc622..b79a960 100644 --- a/simulations/lecture/normaldata.py +++ b/simulations/lecture/normaldata.py @@ -15,9 +15,8 @@ if __name__ == "__main__": indices = np.arange(n) data = sigma*rng.randn(len(indices))+mu - fig = plt.figure(figsize=cm_size(16.0, 6.0)) - spec = gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[3, 1], - left=0.12, bottom=0.23, right=0.97, top=0.96, wspace=0.08) + fig = plt.figure() + spec = gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[3, 1], left=0.12, wspace=0.08) ax1 = fig.add_subplot(spec[0, 0]) show_spines(ax1, 'lb') ax1.scatter(indices, data, c=colors['blue'], edgecolor='white', s=50) diff --git a/simulations/lecture/randomnumbers.py b/simulations/lecture/randomnumbers.py index 7a2609a..8795205 100644 --- a/simulations/lecture/randomnumbers.py +++ b/simulations/lecture/randomnumbers.py @@ -20,9 +20,9 @@ if __name__ == "__main__": lags = np.arange(-maxl, maxl+1, 1) corrs = [np.corrcoef(x[maxl:-maxl-1-l], x[maxl+l:-maxl-1])[0, 1] for l in lags] - fig = plt.figure(figsize=cm_size(16.0, 11.0)) + fig = plt.figure(figsize=cm_size(figure_width, 1.8*figure_height)) spec = gridspec.GridSpec(nrows=2, ncols=2, - left=0.10, bottom=0.12, right=0.98, top=0.97, + left=0.11, bottom=0.12, right=0.98, top=0.97, wspace=0.4, hspace=0.6) ax = fig.add_subplot(spec[0, 0]) diff --git a/simulations/lecture/staticnonlinearity.py b/simulations/lecture/staticnonlinearity.py index 737c723..627dc0d 100644 --- a/simulations/lecture/staticnonlinearity.py +++ b/simulations/lecture/staticnonlinearity.py @@ -20,9 +20,8 @@ if __name__ == "__main__": xx = np.linspace(xmin, xmax, 200) yy = boltzmann(xx, x0, k) - fig = plt.figure(figsize=cm_size(16.0, 6.0)) - spec = gridspec.GridSpec(nrows=1, ncols=2, - left=0.12, bottom=0.23, right=0.97, top=0.96, wspace=0.4) + fig = plt.figure() + spec = gridspec.GridSpec(nrows=1, ncols=2, left=0.1, wspace=0.4) ax1 = fig.add_subplot(spec[0, 0]) show_spines(ax1, 'lb') ax1.plot(xx, yy, colors['red'], lw=2)