NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ChartGen: Scaling Chart Understanding Via Code-Guided Synthetic Chart Generation

Jovana Kondic, Pengyuan Li, Dhiraj Joshi, Zexue He, Shafiq Abedin, Jennifer Sun, Ben Wiesel, Eli Schwartz, Ahmed Nassar, Bo Wu, Assaf Arbelle, Aude Oliva, Dan Gutfreund, Leonid Karlinsky, Rogério FerisarXiv 2025

Abstract

Chart-to-code reconstruction—the task of recovering executable plotting scripts from chart images—provides important insights into a model's ability to ground data visualizations in precise, machine-readable form. Yet many existing multimodal benchmarks focus primarily on answering questions about charts or summarizing them. To bridge this gap, we present ChartGen, a fully-automated pipeline for code-guided synthetic chart generation. Starting from seed chart images, ChartGen (i) prompts a vision-language model (VLM) to reconstruct each image into a python script, and (ii) iteratively augments that script with a code-oriented large language model (LLM). Using ChartGen, we create 222.5K unique chart-image code pairs from 13K seed chart images, covering 27 chart types and 11 plotting libraries. We curate a held-out evaluation subset of 4.3K pairs and evaluate six open-weight VLMs, highlighting substantial room for progress.

Introduction

While AI models have become proficient at basic chart question-answering, they struggle with chart-to-code reconstruction: the ability to generate the exact executable script required to recreate a visualization from its pixels. The primary bottleneck is data scarcity. Most existing datasets are small or limited to single libraries like Matplotlib. Without a large-scale corpus of images paired with structured source code, Vision-Language Models (VLMs) cannot learn the complex mapping between high-dimensional pixels and semantic code.

The ChartGen Pipeline

To address this, we introduce ChartGen, a two-stage automated pipeline designed to scale training data for chart understanding by "redrawing" images into Python code and then iteratively augmenting that code.

The ChartGen Pipeline: A VLM reconstructs a seed image into code, which is then iteratively augmented by a code-centric LLM to produce diverse variants.

The pipeline operates in three key steps:

  1. VLM-based Redrawing: A VLM (phi-3.5-vision-instruct) acts as a visualization expert to write a Python script reconstructing a "seed" chart image as accurately as possible.
  2. LLM-based Code Augmentation: A code-centric LLM (Codestral-22B) transforms the generated script by changing chart types (e.g., bar to 3D scatter), switching plotting libraries, or varying data distributions.
  3. Multimodal Expansion: Because the output is executable code, the system automatically extracts CSV data, natural language summaries, and QA pairs directly from the code's logic, ensuring high ground-truth accuracy.

The ChartGen-200K Dataset

Using this pipeline on 13,000 seed images from ChartQA, we produced ChartGen-200K, containing 222,500 unique chart-image/code pairs. This dataset is orders of magnitude larger than previous efforts like Plot2Code or ChartMimic. It covers 27 chart types and 11 different Python libraries, including Matplotlib, Seaborn, Plotly, Bokeh, and Altair.

An example of an augmented chart (Augmentation 9) produced by the pipeline, demonstrating the ability to generate complex stacked visualizations from code mutations.

Key Insights and Results

By treating code as the foundational "source of truth," ChartGen generates perfectly aligned multimodal data. Our iterative diversification approach allows a single seed image to spawn dozens of diverse descendants, bridging the gap between small domain-specific corpora and the scale required for modern VLM training.

Evaluation of six open-weight VLMs on a held-out subset revealed several key findings:

  • Execution Success: InternVL-2.5 (26B) achieved the highest execution rate, with 86% of its generated scripts running without error.
  • Data Fidelity: Granite-Vision-3.1 (3B) led in data fidelity (0.58/1.0), suggesting architecture may outweigh parameter count for precise chart parsing.
  • Performance Gap: Even top models scored only ~5.8/10 on code similarity and 7.5/10 on image similarity compared to ground truth, indicating that faithful chart-to-code reconstruction remains a significant challenge.

Conclusion

ChartGen demonstrates that code-guided augmentation is a powerful tool for scaling multimodal datasets. While synthetic data provides necessary scale, future work must address representational biases and ensure generalization to "in-the-wild" charts with unconventional layouts. We release our pipeline and dataset to accelerate progress in vision-conditioned code generation.

Summary updated

BibTeX
@misc{kondic2025chartgen,
  author = {Jovana Kondic and Pengyuan Li and Dhiraj Joshi and Zexue He and Shafiq Abedin and Jennifer Sun and Ben Wiesel and Eli Schwartz and Ahmed Nassar and Bo Wu and Assaf Arbelle and Aude Oliva and Dan Gutfreund and Leonid Karlinsky and Rogério Feris},
  title = {{ChartGen: Scaling Chart Understanding Via Code-Guided Synthetic Chart Generation}},
  year = {2025},
  eprint = {2507.19492},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.19492},
}
Figure