MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / write_svg

Function write_svg

experiments/human_eval/draw_error_analysis_figure.py:308–326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

306
307
308def write_svg() -> None:
309 parts = [
310 f'<svg xmlns="http://www.w3.org/2000/svg" width="{W}" height="{H}" viewBox="0 0 {W} {H}">',
311 '<rect width="100%" height="100%" fill="white"/>',
312 "<!-- The publication PDF/PNG is rendered from the same data by PIL. -->",
313 ]
314 for idx, panel in enumerate(PANELS):
315 x, y = panel_position(idx)
316 parts.append(
317 f'<rect x="{x}" y="{y + 72}" width="{PANEL_W}" height="{PANEL_H - 72}" '
318 f'fill="rgb{BG}" stroke="rgb{NAVY}" stroke-width="4"/>'
319 )
320 parts.append(
321 f'<text x="{x + PANEL_W / 2}" y="{y + 40}" text-anchor="middle" '
322 f'font-family="Times New Roman" font-size="36" font-style="italic" '
323 f'font-weight="700" fill="rgb{TITLE_RED}">{svg_escape(panel["title"])}</text>'
324 )
325 parts.append("</svg>")
326 SVG_OUT.write_text("\n".join(parts), encoding="utf-8")
327
328
329def main() -> None:

Callers 1

mainFunction · 0.70

Calls 2

panel_positionFunction · 0.85
svg_escapeFunction · 0.85

Tested by

no test coverage detected