diff --git a/paper/pnas/figs/fig1a.pdf b/paper/pnas/figs/fig1a.pdf index 5a1b16e..43f78b3 100644 Binary files a/paper/pnas/figs/fig1a.pdf and b/paper/pnas/figs/fig1a.pdf differ diff --git a/paper/pnas/main.pdf b/paper/pnas/main.pdf index 5a69f3b..ff03958 100644 Binary files a/paper/pnas/main.pdf and b/paper/pnas/main.pdf differ diff --git a/paper/pnas/make_figs.py b/paper/pnas/make_figs.py index 1e945db..8d3d143 100644 --- a/paper/pnas/make_figs.py +++ b/paper/pnas/make_figs.py @@ -54,7 +54,7 @@ def _icon(svg_name: str): svg = OUT / "icons" / svg_name with tempfile.NamedTemporaryFile(suffix=".png") as f: try: - subprocess.run(["rsvg-convert", "-w", "2048", "-h", "2048", "-o", f.name, str(svg)], + subprocess.run(["rsvg-convert", "-w", "1024", "-h", "1024", "-o", f.name, str(svg)], check=True, capture_output=True) except FileNotFoundError as e: raise RuntimeError("rsvg-convert (librsvg) is required to rasterise the icon SVGs " @@ -122,8 +122,6 @@ def fig1a(): xs = [x0, x0 + cw + sep, x0 + 2 * cw + sep] row_h, row_top = 0.157, 0.805 - from matplotlib.offsetbox import AnnotationBbox, OffsetImage - for j2, (name, arch, guarantee, edge, face, headfill, textcol, icon) in enumerate(TIERS): x = xs[j2] xc = x + cw / 2 - 0.02 # text centred left of the icon slot @@ -135,9 +133,16 @@ def fig1a(): linespacing=1.3, color=textcol) ax.text(xc, 0.833, guarantee, ha="center", va="bottom", fontsize=6.4, style="italic", color=textcol, alpha=0.85) + # Reason: imshow + interpolation="none" embeds the icon unsampled in the PDF (an + # OffsetImage is always composited at figure dpi, i.e. ~39 px, whatever the source). img = _icon(icon) - ax.add_artist(AnnotationBbox(OffsetImage(img, zoom=28.0 / img.shape[0]), - (x + cw - gap - 0.024, 0.902), frameon=False)) + iw = 28.0 / 1140.0 # 28 display px on an 11.4in/100dpi fig + ih = iw * 11.4 / 5.3 + icx, icy = x + cw - gap - 0.024, 0.902 + ax.imshow(img, extent=(icx - iw / 2, icx + iw / 2, icy - ih / 2, icy + ih / 2), + interpolation="none", aspect="auto", zorder=5) + ax.set_xlim(0, 1) + ax.set_ylim(0, 1) for i2, (label, definition, cells) in enumerate(ROWS): tags = TAGS[i2]