[plotstyle] adjust_fs() function for plot margins as multiples of font size

This commit is contained in:
2020-01-04 12:54:09 +01:00
parent 048bce0a20
commit 78cd41001a
5 changed files with 56 additions and 12 deletions

View File

@@ -16,7 +16,8 @@ if __name__ == "__main__":
data = sigma*rng.randn(len(indices))+mu
fig = plt.figure()
spec = gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[3, 1], left=0.12, wspace=0.08)
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])
show_spines(ax1, 'lb')
ax1.scatter(indices, data, c=colors['blue'], edgecolor='white', s=50)

View File

@@ -21,9 +21,7 @@ if __name__ == "__main__":
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(figure_width, 1.8*figure_height))
spec = gridspec.GridSpec(nrows=2, ncols=2,
left=0.11, bottom=0.12, right=0.98, top=0.97,
wspace=0.4, hspace=0.6)
spec = gridspec.GridSpec(nrows=2, ncols=2, **adjust_fs(fig))
ax = fig.add_subplot(spec[0, 0])
show_spines(ax, 'lb')

View File

@@ -21,7 +21,7 @@ if __name__ == "__main__":
yy = boltzmann(xx, x0, k)
fig = plt.figure()
spec = gridspec.GridSpec(nrows=1, ncols=2, left=0.1, wspace=0.4)
spec = gridspec.GridSpec(nrows=1, ncols=2, **adjust_fs(fig, left=4.5))
ax1 = fig.add_subplot(spec[0, 0])
show_spines(ax1, 'lb')
ax1.plot(xx, yy, colors['red'], lw=2)