global figure sizes and subplot adjust values

This commit is contained in:
Jan Benda 2020-01-04 11:37:55 +01:00
parent 2a0e1adff8
commit 048bce0a20
7 changed files with 20 additions and 12 deletions

View File

@ -1,4 +1,3 @@
\documentclass[12pt]{book}
\input{../../header}

View File

@ -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}

View File

@ -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

View File

@ -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));

View File

@ -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)

View File

@ -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])

View File

@ -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)