qaenthrix-eve / make_figures.py
PureOne's picture
Release QAENTHRIX 3.0.0: proofs and reproducible research
81a3ea5 verified
Raw History Blame Contribute Delete
1.81 kB
"""Exact theorem illustrations; no simulated or empirical values are plotted."""
from pathlib import Path
from math import comb
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.rcParams.update({'font.family':'DejaVu Sans', 'font.size':11,
'axes.spines.top':False, 'axes.spines.right':False,
'axes.labelcolor':'#182832', 'text.color':'#182832'})
fig, axes = plt.subplots(1, 2, figsize=(9.4, 3.75), layout='constrained')
n, rank, lam, mu = 8, 3, 1., .15
widths = np.arange(n+1)
pointwise = np.array([lam]*rank+[mu]*(n-rank)+[0.])
global_error = np.array([lam]*n+[0.])
axes[0].plot(widths, global_error, 's-', color='#A44865', lw=2, ms=5, label='Continuous global family')
axes[0].plot(widths, pointwise, 'o-', color='#156D72', lw=2, ms=5, label='Pointwise factors')
axes[0].set(xlabel='Fixed complex output coordinates, m', ylabel='Optimal worst-case energy error',
title='(a) n = 8, r = 3, λ = 1, μ = 0.15', xticks=[0,2,3,4,6,8], ylim=(-.04,1.15))
axes[0].legend(fontsize=9, loc='center', bbox_to_anchor=(.5,.6), frameon=False)
axes[0].grid(axis='y', alpha=.2)
ranks = np.arange(1,n)
minimal = ranks*(n-ranks)+1
coordinate = [comb(n,int(r)) for r in ranks]
axes[1].plot(ranks, coordinate, 'o-', color='#A44865', lw=2, ms=5, label='Coordinate atlas')
axes[1].plot(ranks, minimal, 's-', color='#156D72', lw=2, ms=5, label='Minimum fixed-reference atlas')
axes[1].set(xlabel='Subspace rank, r', ylabel='Number of fixed reference frames',
title='(b) Exact atlas counts for n = 8', xticks=ranks, ylim=(0,80))
axes[1].legend(fontsize=9, loc='upper left', frameon=False)
axes[1].grid(axis='y',alpha=.2)
fig.savefig(Path(__file__).with_name('FIGURE_01.png'),dpi=300,facecolor='white')
plt.close(fig)