"""Colours and fonts of Figures 1-4 (the same as Figures 5-7).""" import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties from matplotlib.textpath import text_to_path plt.rcParams.update({"pdf.fonttype": 42, "ps.fonttype": 42, "font.family": "sans-serif", "font.sans-serif": ["Helvetica", "Arial"], "font.size": 8}) BOLD = dict(fontfamily='Arial', fontweight='bold') C_MAIN, C_TRIB, C_OTHER, C_STRIP = '#0072B2', '#D55E00', '#9a9a9a', '#d0d0d0' T_MAIN, T_TRIB, T_DARK, T_GREY = '#005a8c', '#b34e00', '#1f1f1f', '#555555' F_TRIB, F_OTHER = '#f9dcc4', '#f0f0f0' FILL = {'above': '#cfe4f2', 'trib': '#f6c8a3', 'below': '#8ebbd9'} def text_inches(text, fontsize, **kw): """Width of a text in inches.""" return text_to_path.get_text_width_height_descent(text, FontProperties(family=kw.get('fontfamily'), weight=kw.get('fontweight'), size=fontsize), False)[0] / 72