File size: 856 Bytes
41dd7e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | """Shared publication style. Figure dimensions are final printed inches."""
import os
from pathlib import Path
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
DIRECT = '#356a98'
CASCADED = '#b74445'
EDM = '#777777'
TRUTH = '#222222'
INK = '#222222'
COLORS = {'Direct SI': DIRECT, 'Cascaded SI': CASCADED, 'EDM': EDM, 'Truth': TRUTH}
plt.rcParams.update({
'font.family': 'serif', 'font.serif': ['STIXGeneral'],
'mathtext.fontset': 'stix', 'font.size': 8,
'axes.labelsize': 8, 'axes.titlesize': 8.5,
'xtick.labelsize': 7, 'ytick.labelsize': 7,
'axes.linewidth': .6, 'lines.linewidth': 1.2,
'pdf.fonttype': 42, 'ps.fonttype': 42,
'savefig.facecolor': 'white',
})
def save(fig, path):
fig.savefig(path.with_suffix('.pdf'), dpi=400)
fig.savefig(path.with_suffix('.png'), dpi=240)
plt.close(fig)
|