# PaperBanana

> Multi-agent generator for academic diagrams and statistical plots

- Category: Multimodal Generation / Image Generation
- Language: Python
- Licence: MIT
- Repository: https://github.com/llmsresearch/paperbanana
- Canonical page: https://ai-tldr.dev/tools/paperbanana/

## In short

PaperBanana generates publication-quality academic figures from text. It sits in the Image Generation category of the Multimodal Generation tools and is open-source, written in Python and licensed MIT. To get started: install.

## Overview

PaperBanana generates publication-quality academic figures from text. Give it a methodology section (a text file or a PDF) and a caption describing what the figure should communicate, and it produces a methodology diagram; give it a CSV or JSON file and an intent, and it produces a statistical plot. Each run is saved under `outputs/run_<timestamp>/` with the final image plus every intermediate iteration and its metadata.

It is an unofficial, community-driven open-source implementation of the paper "PaperBanana: Automating Academic Illustration for AI Scientists" (Zhu et al., arXiv:2601.23265). The README states plainly that the project is not affiliated with or endorsed by the original authors or Google Research, and that it is based on the publicly available paper and may differ from the original system. It is MIT-licensed Python and asks users to cite the original paper.

Under the hood it runs a multi-agent pipeline of up to seven agents. An optional input optimizer enriches the raw methodology text and sharpens a vague caption into a precise visual specification. A Retriever then picks relevant examples from a curated set of 13 methodology diagrams, a Planner writes a detailed description of the target figure, and a Stylist applies NeurIPS-style aesthetic guidelines. Finally a Visualizer renders the image and a Critic checks it against the source and revises the description, looping for a fixed number of rounds (three by default) or, with `--auto`, until the critic is satisfied. Plots are rendered through VLM-generated matplotlib code, so they need no image-generation provider.

## What it does

- Two-phase multi-agent pipeline (Retriever, Planner, Stylist, then Visualizer and Critic in a refinement loop) with an optional input-optimization phase
- Methodology diagrams from text or PDF input (with per-page selection), optionally guided by reference or hand-drawn sketch images
- Statistical plots from CSV or JSON data, rendered as matplotlib code written by the VLM
- Providers for OpenAI, Azure OpenAI / Foundry, Google Gemini, Atlas Cloud and OpenRouter, switchable by flag or YAML config
- Batch manifests, full-paper figure packages (`orchestrate`), multi-panel composites, figure polishing and VLM-as-a-Judge evaluation on faithfulness, readability, conciseness and aesthetics
- CLI, Python API, a local Gradio web UI (PaperBanana Studio), an MCP server with eleven tools, and a GitHub Action for Overleaf-synced papers

## Getting started

You need Python 3.10+ and an API key for OpenAI (or an Azure OpenAI / Foundry endpoint) or Google Gemini. The README also links a Colab quickstart notebook that runs the whole flow in the browser.

1. Install

   Install from PyPI, or clone the repo for development.

```bash
pip install paperbanana

# or from source
git clone https://github.com/llmsresearch/paperbanana.git
cd paperbanana
pip install -e ".[dev,openai,google]"
```

2. Add an API key

   Put your key in `.env`, or run the interactive setup wizard for Gemini.

```bash
cp .env.example .env
# Edit .env and add your API key:
#   OPENAI_API_KEY=your-key-here
#   GOOGLE_API_KEY=your-key-here

paperbanana setup
```

3. Generate a methodology diagram

   `--optimize` preprocesses the inputs and `--auto` keeps refining until the critic is satisfied. The result lands in `outputs/run_<timestamp>/final_output.png`.

```bash
paperbanana generate \
  --input my_method.txt \
  --caption "Overview of our encoder-decoder framework" \
  --optimize --auto
```

4. Iterate with feedback, or plot data

   Continue the latest run with your own notes for the critic, or turn a results file into a chart.

```bash
paperbanana generate --continue \
  --feedback "Make arrows thicker and colors more distinct"

paperbanana plot \
  --data results.csv \
  --intent "Bar chart comparing model accuracy across benchmarks"
```

5. Or use the web UI

   PaperBanana Studio exposes the same workflows in a local Gradio app, by default at http://127.0.0.1:7860/.

```bash
pip install 'paperbanana[studio]'
paperbanana studio
```

6. Use it from an MCP client

   Add the server to Claude Code, Cursor or any MCP-compatible client via `uvx`, without a local clone.

```json
{
  "mcpServers": {
    "paperbanana": {
      "command": "uvx",
      "args": ["--from", "paperbanana[mcp]", "paperbanana-mcp"],
      "env": { "GOOGLE_API_KEY": "your-google-api-key" }
    }
  }
}
```

## When to use it

- Draft the method-overview figure for a paper straight from its methodology section, then refine it with written feedback
- Turn experiment results in CSV or JSON into consistently styled plots for a venue such as NeurIPS, ICML, ACL or IEEE
- Produce a whole figure package (images, LaTeX snippet and captions) for a paper in one `orchestrate` run
- Keep an Overleaf paper's methodology figure in sync with its text through the bundled GitHub Action
