reference_image imagewidth (px) 703 4.47k | id stringlengths 11 44 | source stringclasses 2
values | chart_type_name stringclasses 12
values | chart_type stringclasses 12
values | panel_mode stringclasses 2
values | in_bench bool 1
class | source_title stringlengths 15 217 ⌀ | seed_dataset stringclasses 3
values | target_data stringlengths 2.6k 2.06M | reference_code stringlengths 1.7k 122k | reference_data listlengths 0 2 | source_url stringlengths 32 54 ⌀ | source_bibkey stringlengths 7 53 ⌀ | seed_url stringclasses 3
values | seed_id stringlengths 14 44 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PMC11502666 | hand-curated | Distribution | T4 | multi | true | Measuring the dynamic balance of integration and segregation underlying consciousness, anesthesia, and sleep in humans | null | block_id,panel_group,panel_row,panel_col,record_type,condition,model_name,canopy_temperature_excess_c,chlorophyll_fluorescence_yield,nitrogen_stress_score,bin_left_score,bin_right_score,normalized_frequency,false_positive_rate,true_positive_rate,averaging_window_days,auc,standard_error,sample_id,replicate_count
A,trait... | """Self-contained renderer for the four-panel ISD figure."""
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import Normalize
OUT = Path(__file__).resolve().parent / "figure.png"
# Deterministic numeric data used by the den... | [
{
"filename": "data.csv",
"content": [
105,
110,
116,
101,
103,
114,
97,
116,
105,
111,
110,
44,
115,
101,
103,
114,
101,
103,
97,
116,
105,
111,
110,
44,
105... | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC11502666/ | Jang_2024 | null | null | |
PMC11840003 | hand-curated | Box/Violin | T5 | multi | true | Time-resolved oxidative signal convergence across the algae–embryophyte divide | null | "block_id,panel_group,panel_row,panel_col,record_type,material_system,coating_family,condition,stres(...TRUNCATED) | "\"\"\"Code-native reconstruction of the PMC11840003 composite figure.\n\nThe original ``code.py`` d(...TRUNCATED) | [] | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC11840003/ | Rieseberg_2025 | null | null | |
PMC12000431 | hand-curated | Distribution | T4 | multi | true | Patterns and drivers of Holocene moisture variability in mid-latitude eastern North America | null | "study_id,panel_group,panel_row,panel_col,panel_title,panel_role,record_type,series_id,series_label,(...TRUNCATED) | "\"\"\"Self-contained, deterministic renderer for the four-panel periodicity figure.\"\"\"\nfrom pat(...TRUNCATED) | [{"filename":"data.csv","content":"cGFuZWwsa2luZCxzaXRlX29yX21vZGVsLHBlcmlvZF9rYSxkZW5zaXR5DQphLHdiL(...TRUNCATED) | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC12000431/ | Salonen_2025 | null | null | |
PMC12354736 | hand-curated | Distribution | T4 | multi | true | Multimodal spatial transcriptomic characterization of mouse kidney injury and repair | null | "block_id,panel_group,panel_row,panel_col,record_type,condition,time_hours,microbial_state,feature_o(...TRUNCATED) | "from pathlib import Path\n\nimport matplotlib\n\nmatplotlib.use(\"Agg\")\n\nimport matplotlib.pyplo(...TRUNCATED) | [{"filename":"data.npz","content":"UEsDBC0AAAAAAAAAIQAWil0J//////////8OABQAZW5yaWNobWVudC5ucHkBABAAC(...TRUNCATED) | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC12354736/ | Xuanyuan_2025 | null | null | |
PMC12504421 | hand-curated | Heatmap | T6 | multi | true | "Human pancreatic α-cell heterogeneity and trajectory inference analyses reveal SMOC1 as a β-cell (...TRUNCATED) | null | "block_id,panel_group,panel_row,panel_col,record_type,trajectory,condition,site,sampling_week,indica(...TRUNCATED) | "#!/usr/bin/env python3\n\"\"\"Self-contained release render for the PMC12504421 trajectory composit(...TRUNCATED) | [{"filename":"data.csv","content":"cGFuZWwscGxvdF90eXBlLHNlcmllcyxpZGVudGl0eSxnZW5lLHgseSx2YWx1ZSxwZ(...TRUNCATED) | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC12504421/ | Kang_2025 | null | null | |
PMC12905268 | hand-curated | Distribution | T4 | multi | true | Soil carbon debt from land use change in Brazil | null | "block_id,panel_group,panel_row,panel_col,estuary_region,sediment_depth_stratum,depth_order,shorelin(...TRUNCATED) | "\"\"\"Self-contained reproduction of the supplied SOC-stocks figure.\"\"\"\nfrom pathlib import Pat(...TRUNCATED) | [{"filename":"data.csv","content":"YmlvbWUsZGVwdGhfY20sbGFuZF91c2Usc29jX3N0b2NrX01nX0NfaGENCk92ZXJhb(...TRUNCATED) | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC12905268/ | Villela_2026 | null | null | |
PMC13009336 | hand-curated | Box/Violin | T5 | multi | true | "A macrophage-induced subpopulation of mesenchymal cells expressing Fcer1g contributes to wound-indu(...TRUNCATED) | null | "block_id,panel_group,panel_row,panel_col,record_type,sample_id,timepoint_days,reef_condition,bacter(...TRUNCATED) | "\"\"\"Self-contained, deterministic renderer for the PMC13009336 sample figure.\"\"\"\nfrom pathlib(...TRUNCATED) | [{"filename":"data.csv","content":"cGFuZWwsZ3JvdXAsdmFsdWUNCmdfc3NHU0VBLE5vcm1hbCBTa2luLDAuNDY1NDQzO(...TRUNCATED) | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC13009336/ | Ma_2026 | null | null | |
PMC13022287 | hand-curated | Distribution | T4 | multi | true | "Molecular signatures and causal factors underlying latent cytomegalovirus infection among people li(...TRUNCATED) | null | "block_id,panel_group,panel_row,panel_col,record_type,subject_id,cohort,condition,category,category_(...TRUNCATED) | "\"\"\"Self-contained, deterministic rendering of the supplied composite figure.\"\"\"\nfrom pathlib(...TRUNCATED) | [{"filename":"data.csv","content":"cGFuZWwsc2VyaWVzLGVsZW1lbnRfdHlwZSxwb2ludF9pbmRleCx4LHkseDIseTIsY(...TRUNCATED) | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC13022287/ | Nguyen_2026 | null | null | |
PMC13079874 | hand-curated | Box/Violin | T5 | multi | true | "Comprehensive benchmarking of metagenomic binning tools reveals key factors for improved genome rec(...TRUNCATED) | null | "block_id,panel_group,panel_row,panel_col,record_type,treatment,hydrologic_zone,measurement,unit,rep(...TRUNCATED) | "\"\"\"Compact, reference-shaped reconstruction of PMC13079874 panels a-e.\n\nThe a-d values are rea(...TRUNCATED) | [{"filename":"data.csv","content":"cGFuZWwsZm9ybWF0X29yX3Rvb2wsdG9vbF9vcl9jYXRlZ29yeSx2YWx1ZQ0KYSxQY(...TRUNCATED) | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC13079874/ | Kim_2026 | null | null | |
PMC13106710 | hand-curated | Heatmap | T6 | multi | true | Behavioral screening defines the molecular Parkinsonism-related subgroups in Drosophila | null | "block_id,panel_group,panel_row,panel_col,record_type,time_hours,light_phase,individual_id,family_id(...TRUNCATED) | "\"\"\"Compact, source-shaped reproduction of panels b, c, e and g.\n\nPanel e uses the genotype-by-(...TRUNCATED) | [{"filename":"data.csv","content":"enQsY3RybF9iX21lYW4scGRmX2JfbWVhbixjdHJsX2dfbWVhbixwYXJrX2dfbWVhb(...TRUNCATED) | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC13106710/ | Kaempf_2026 | null | null |
PlotTwin-Bench
PlotTwin-Bench is a benchmark for figure style transfer: given a reference figure and a new dataset, produce a plotting script that draws the new data in the reference's visual style. Every reference is a publication-style matplotlib figure shipped with the script that renders it.
Configs
| config | rows | style-transfer tasks | contents |
|---|---|---|---|
bench (default) |
150 | 150 | the evaluation set: all 50 hand-curated references and 100 augmented references sampled at random |
full |
399 | 150 | every reference: 50 hand-curated and 349 augmented; the 150 bench rows carry target data |
bench is a subset of full, and each bench row appears in full unchanged.
from datasets import load_dataset
bench = load_dataset("figmirror/PlotTwin-Bench", split="test") # 150 tasks
full = load_dataset("figmirror/PlotTwin-Bench", "full", split="test") # 399 references
tasks = full.filter(lambda x: x, input_columns="in_bench") # same 150 tasks
Two sources
Hand-curated (50). Complex figures selected from papers at top venues and
journals, each replotted by hand in matplotlib to form an aligned figure–code
pair. Every hand-curated row cites the figure it was replotted from
(source_url, source_title, source_bibkey; BibTeX in sources.bib). The
reference image is our own rendering, not the published figure.
Augmented (349). Plotting code from existing chart-to-code datasets,
rewritten by an LLM pipeline into more complex and visually polished figures,
then filtered for both properties. Each row records its seed (seed_dataset,
seed_url, seed_id).
Task
A task pairs reference_image with target_data, a CSV describing a new study
in a different scientific domain. The target data keeps the reference's chart
families and panel structure and changes one to three aspects of the data, such
as series count, category cardinality, panel allocation or scale type. A method
returns a self-contained plotting script that draws target_data in the style
of reference_image.
Fields
| field | type | description |
|---|---|---|
reference_image |
image | the reference figure, rendered by reference_code |
id |
string | sample id |
source |
string | hand-curated or augmented |
chart_type, chart_type_name |
string | one of 12 chart types, T1 Bar … T12 Composite |
panel_mode |
string | single or multi |
in_bench |
bool | the row belongs to the bench evaluation set |
source_url, source_title, source_bibkey |
string | publication a hand-curated reference was replotted from |
seed_dataset, seed_url, seed_id |
string | upstream seed of an augmented reference |
target_data |
string | CSV to plot in the reference style; set on the 150 task rows |
reference_code |
string | matplotlib script that renders reference_image |
reference_data |
list | data files the script reads (filename, content) |
Rendering a reference
reference_code reads its data files from its own directory and saves one PNG.
from pathlib import Path
import subprocess, sys
def materialize(row, workdir):
workdir = Path(workdir) / row["id"]
workdir.mkdir(parents=True, exist_ok=True)
(workdir / "code.py").write_text(row["reference_code"])
for f in row["reference_data"]:
(workdir / f["filename"]).write_bytes(f["content"])
if row["target_data"]:
(workdir / "target_data.csv").write_text(row["target_data"])
return workdir
sample = materialize(bench[0], "plottwin")
subprocess.run([sys.executable, "code.py"], cwd=sample, check=True)
The released images were rendered with Python 3.13, matplotlib 3.10.9 and numpy 2.4.4 (Agg backend). Other font sets or library versions can change text rasterisation slightly.
Scoring
The scorer/ folder holds the PlotTwin-Bench scorer (deviation-defect-v1).
- S_code parses the reference and candidate scripts and compares nine style attributes: palette, background, figure aspect, line width, grid, hidden spines, tick direction, serif font and legend frame. An attribute counts only when the reference departs from the matplotlib default.
- S_vision shows a vision model the reference and the candidate image and asks for every reference style choice the candidate misses. Each miss deducts 5, 10 or 25 points (minor, major, critical) from 100.
- S averages each channel over a split and blends them:
S = 0.65 · S_vision + 0.35 · S_code.
A prediction is one <id>.py per task. The script reads the target data from
data.csv in its working directory and saves one PNG; the scorer renders it.
A <id>.png next to the script is used as the candidate image instead.
hf download figmirror/PlotTwin-Bench --repo-type dataset --include "scorer/*" --local-dir plottwin
cd plottwin/scorer
export OPENAI_API_KEY=... # set OPENAI_BASE_URL for any OpenAI-compatible endpoint
uv run plottwin-score --pred-dir /path/to/predictions --out-dir scores
The vision model defaults to gpt-5.5; set --model and --reasoning-effort
to change it. Per-sample results go to scores/per_sample/<id>.json and are
reused when a run restarts; scores/summary.json reports S, S_code and
S_vision for the hand-curated and augmented splits. examples/quickstart.py
scores a default-style baseline on three tasks end to end:
uv run python examples/quickstart.py
Chart types
| type | hand-curated | augmented (full) |
bench total |
|---|---|---|---|
| T1 Bar | 0 | 140 | 18 |
| T2 Line | 5 | 70 | 20 |
| T3 Scatter | 5 | 25 | 16 |
| T4 Distribution | 9 | 10 | 17 |
| T5 Box/Violin | 5 | 27 | 16 |
| T6 Heatmap | 4 | 19 | 14 |
| T7 Field 2D | 5 | 19 | 15 |
| T8 3D | 4 | 5 | 7 |
| T9 Network/Tree | 2 | 3 | 2 |
| T10 Polar/Radial | 1 | 29 | 13 |
| T11 Std-band | 7 | 2 | 9 |
| T12 Composite | 3 | 0 | 3 |
License and attribution
PlotTwin-Bench is released under CC BY-NC 4.0. Augmented references derive from the plotting code of these datasets; follow their terms as well:
| seed dataset | rows in full |
upstream terms |
|---|---|---|
| ChartNet | 151 | non-commercial notice |
| Chart2Code | 151 | level 1 follows ChartMimic (Apache-2.0); levels 2–3 state no licence |
| Chart2NCode | 31 | CC BY-NC 4.0 |
| ChartMimic | 15 | Apache-2.0 |
| ChartGen-200K | 1 | CC BY 4.0 |
Hand-curated references are our own matplotlib replots; please also cite the
original publications listed in sources.bib when you discuss individual
figures.
Citation
@misc{zhao2026figmirrorgrounditcode,
title = {FigMirror: Ground It, Code It, Plot It},
author = {Xiaohan Zhao and Jiacheng Liu and Yaxin Luo and Zhiqiang Shen},
year = {2026},
eprint = {2608.28814},
archivePrefix = {arXiv},
primaryClass = {cs.CV},
url = {https://arxiv.org/abs/2608.28814}
}
- Downloads last month
- -