arXiv(opens in a new tab)cs.AISep 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2609.01006

Figures as Programs: Recursive Generation of Editable Scientific Figures

Yepeng Liu, Dasen Dai, Chengzhi Liu, Yiren Song, Hai Ci, Yu Zhang, Qi Zhang, Mike Zheng Shou, Xin Eric Wang, Yuheng Bu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

Abstract

Scientific methodology figures are essential for communicating complex methods clearly, yet creating them remains labor-intensive and typically requires multiple rounds of refinement. Recent image-generation models can synthesize visually appealing raster figures, but producing a human-satisfactory result in a single generation step remains difficult. Moreover, precise edits to raster figures are challenging for both humans and models. We formulate scientific figure generation as recursive SVG program construction and propose FIGTREE, a multi-agent system that automatically transforms a scientific paper into a structured vector figure. FIGTREE grounds figure content in the source paper, decomposes a figure into a hierarchy of local regions, generates each region as a short SVG program, and assembles the resulting fragments. A render-critic refinement loop jointly inspects the rendered figure and its underlying program, enabling visual defects to be traced to specific statements and accurately repaired. We conduct extensive evaluations of FIGTREE on figure quality and editability, showing that FIGTREE produces high-quality figures, while also enabling more effective editing than existing raster-based methods. Our code is available at https://github.com/yepengliu/FigTree.

1 Introduction

Automated AI Scientists demonstrate the ability to propose hypotheses, run experiments, and write papers with limited human oversight [1–5]. High-quality methodology figures are essential to a research paper, as they often reach readers before the text. However, producing such figures still requires significant human effort.

Recent state-of-the-art image generation models, such as Nano Banana Pro [6] and GPT-Image-2 [7], are capable of generating scientific methodology figures directly as raster images. However, these figures are often complex, containing many interdependent components, which makes satisfactory one-shot generation challenging. The resulting images may include hallucinated elements, illegible text, or insufficient resolution. Consequently, iterative refinement is often necessary, guided by either a human or a vision-language model (VLM) critic [8–11].

PaperBanana [12], for example, introduces an agentic framework that iteratively refines a raster figure using feedback from a VLM critic, which translates identified issues into instructions for the image-generation model. However, natural language-guided refinement of raster images remains difficult for both parties: the critic must describe the intended modification with sufficient spatial precision, while the generator must apply it faithfully without disturbing unrelated content. Manual editing faces a similar limitation because raster images expose no explicit structure for selecting and modifying individual elements. These challenges motivate us to investigate a more editable and controllable representation for scientific methodology figures.

*These authors contributed equally to this work.

†Correspondence to: yepengliu@ucsb.edu

In this paper, we recast scientific figure generation from image generation to code generation: a Large Language Model (LLM) writes a vector graphics program (e.g., SVG) that renders the figure, providing editability and resolution independence. Prior works have demonstrated the potential of LLMs to generate code that produces various types of vector graphics [13–17], such as icons, illustrations, and simple diagrams. However, methodology diagrams in research papers are substantially more complex: they pack various elements and dense spatial relations into a long program. This shift from image generation to long-horizon code generation raises three challenges. (1) Generation reliability: a whole figure corresponds to a long-horizon program with many coordinates, so errors may accumulate and surface as misalignment and overlap. (2) Spatial planning: the model must lay out components from code alone, which demands spatial reasoning without visual feedback. (3) Verification and repair: defects that are invisible in the code, such as occlusion or overflowing text, may surface only after rendering.

To address these challenges, we present FIGTREE, a multi-agent system that generates a scientific figure as an editable SVG program through recursive decomposition. Our core insight is that a scientific figure is compositional: it forms a hierarchy of regions, each containing a few primitives. An SVG program mirrors this structure: it allows us to write each region as a subprogram independently, and then assemble them into a complete figure. This turns one hard global generation problem into many simpler local ones. For generation reliability, FIGTREE decomposes a scientific figure into a layout tree and writes a short program at each node, so no single step needs to reason about the whole figure. For spatial planning, each child reports the space occupied by its fragment and exposes named ports for external connections. The parent uses these reports to place its children and draw the connections between them, since it is the first node with access to both endpoints. For verification and repair, a critic inspects both the rendered image, where defects surface, and the corresponding program, where each defect can be traced to a statement, allowing the generator to edit only the offending element in place.

Our contributions are as follows:

  • We formulate editable scientific figure generation as recursive SVG program construction and propose FIGTREE, a multi-agent system that integrates recursive decomposition, fragment merging, and iterative refinement.
  • For figure quality, we complement reference-based comparison with a fine-grained rubric. For editability, we introduce an iterative-editing evaluation to measure how effectively generated artifacts can be refined over multiple rounds.
  • We show that FIGTREE produces high-quality figures, with particularly strong performance in hallucination control compared with existing methods. Moreover, FIGTREE achieves superior editing efficiency and higher figure quality than raster-based methods under the same number of editing rounds.

References (30)