Prototype Research Graphics with Antigravity, Then Rebuild in Code

Use image generation to explore layout and hierarchy, then use R or Python to produce the quantitative figure that readers can audit and rerun.

Research graphics have two separable problems. The first is evidentiary: every point, interval, label, and geographic boundary must come from the analysis. The second is visual: the hierarchy, spacing, and annotation need to help a reader see the result. Code is the authoritative route for the first problem. Image generation can be useful for exploring the second.

Google Antigravity is an agentic development platform that can invoke an image-generation model for mockups, diagrams, and visual assets. That makes it useful for testing a layout brief. It does not make a generated image an auditable statistical figure.

The rule for this workflow is simple: generated images are design sketches, never the source of quantitative or geographic truth. The final coefficient plot, map, or descriptive chart is rebuilt from data in R or Python and checked against saved output.


The Visual Reasoning Gap

When a coding agent creates a coefficient plot, the core sequence is:

  1. The AI translates the request into matplotlib syntax
  2. It specifies positions as numerical coordinates
  3. The plotting library renders those coordinates exactly as specified
  4. A human or an image-aware review step inspects the rendered result

The fourth step is the one that matters. A workflow with no rendered-image review can miss overlaps and poor hierarchy. A workflow that lets an agent inspect the render may catch some of them, but the release decision still belongs to the researcher. An Antigravity mockup can make the desired hierarchy concrete before the code is revised.


What Makes an Antigravity Prompt Work

Vague prompts produce vague results. The difference between frustration and a usable output comes down to structure.

The Coefficient Plot Prompt

The values in this prompt are hypothetical teaching data. They show how to specify a graphic, not a published food-security result.

Create a coefficient plot showing four predictors of food vulnerability:
poverty rate, SNAP enrollment, vehicle access, and transit time.

Include 95% confidence intervals as horizontal lines through each point.
Add a vertical dashed line at zero.

Use these approximate values:
- Poverty Rate: 0.42 (CI: 0.28 to 0.58)
- SNAP Enrollment: 0.31 (CI: 0.18 to 0.45)
- No Vehicle Access: 0.19 (CI: 0.08 to 0.29)
- Transit Time (min): 0.08 (CI: 0.02 to 0.14)

Title: "Predictors of Food Vulnerability"
Subtitle: "Coefficient Estimates with 95% Confidence Intervals"
Source note: "Hypothetical teaching example"

Use a clean, publication-ready style with readable axis labels.

Why this works:

  • Visualization type ("coefficient plot") — Anchors the request in a known format
  • Exact values with CIs — Supplies a verification target; the generated image can still misplace or alter them
  • Structural elements ("dashed line at zero") — Specifies conventions the AI might omit
  • All text content — Nothing left to imagination

The key insight: provide the data explicitly. Stating the values reduces ambiguity and supplies a target for comparison. It does not ensure that the generated image preserves them.


The Icon Array Prompt

This icon-array prompt also uses a hypothetical one-in-eight proportion. A transit article on this site reports a roughly 12% tract rate, but its population and routing record are under reconciliation. The example below is not a restatement of that result.

Create an icon array for a hypothetical statistic: 1 in 8 units
meets a defined threshold.

Show a grid of 24 rounded squares arranged in 3 rows of 8.
Highlight 3 squares in red (#dc2626), leave 21 squares in light gray (#e5e7eb).

Title: "Hypothetical one-in-eight example"
Subtitle: "3 of 24 units meet the example threshold"

Legend at bottom:
- Red square = "Meets threshold"
- Gray square = "Does not meet threshold"
- Note: "Illustrative values, not an empirical estimate"

Why this works:

  • Grid dimensions ("3 rows of 8") — Prevents wrong proportions
  • Exact count ("3 highlighted") — Mathematically correct (3/24 = 1/8)
  • Hex colors (#dc2626) — Precise control; "red" is ambiguous

The Map Layout Mockup

Create a low-fidelity layout mockup for a choropleth figure.
Do not draw real census tracts or imply that the mockup is a data map.

Use a gray rectangle labeled "verified map generated in Python".
Place a five-step light-to-dark blue legend to its right.

Title: "Food Vulnerability by Census Tract"
Legend: "Vulnerability Score"
Source note: "Layout mockup only; geography and values added from code"

Use a clean white background and leave room for a methods note.

Why this works:

  • Explicit placeholder keeps synthetic geography out of the final figure
  • Color scale direction ("light = low") records the intended visual grammar
  • Methods-note space reserves room for the choices readers need to interpret

The Five Rules for Effective Prompts

  1. Name the visualization type. "Coefficient plot," not "a chart showing regression results."
  2. Label every value as hypothetical. Exact empirical values belong in the code-produced final, not in an image-generation workflow.
  3. Specify colors with hex codes. "Blue" is ambiguous. #2563eb is precise.
  4. Include all text. Titles, subtitles, axis labels, legend entries, source notes. Everything.
  5. State what you don't want. "No gridlines," "white background." Negative instructions can reduce clutter.

The Verification Imperative

Here's the catch: we can only outsource what we can verify.

When Antigravity generates a coefficient plot, how do we know the point estimates are plotted at the correct values? That the confidence intervals are the right width? That the scale is accurate?

With code, we can trace the pipeline: data → transformation → plot command → output. With image generation, there is no equivalent guarantee that spatial positions, text, or numeric marks preserve the supplied values.

Three verification approaches:

1. Keep code output authoritative. Generate the figure in R or Python from the analysis data. Use the Antigravity result as a layout reference, then implement the useful design choices back in code.

2. Request explicit data labels. Prompt the tool to label each point with its value: "Label each coefficient with its point estimate and confidence interval." The labels can then be compared with the source table, although that check does not prove that each mark is positioned correctly.

3. Verify the rebuilt figure. Compare labels and plotted values against a saved table, inspect the rendered image, and rerun the script in a clean environment when the figure carries an empirical claim.

The approach depends on the graphic type. For coefficient plots with precise numerical claims, always verify. For a hypothetical icon array, counting highlighted squares verifies that the rendering matches the prompt, but it does not validate any underlying empirical statistic. For conceptual diagrams like DAGs, verify logical relationships rather than numerical precision.


When Code Still Wins

Antigravity doesn't replace code for everything:

Reproducibility. If you need to regenerate the same figure with updated data, code wins. Antigravity may produce slightly different results across sessions.

Automation. If you're generating 50 county-level maps programmatically, code wins. Antigravity is conversational, great for single outputs but inefficient for batch processing.

Iteration. When you're still exploring and don't know what the final graphic should look like, quick-and-dirty code output helps you think. Save Antigravity for when decisions are settled.


The Hybrid Workflow

In practice, we use multiple tools:

  1. R/Python for iterating on design choices (free, reproducible)
  2. R/Python for verification baseline (verifiably correct)
  3. Antigravity for an optional layout mockup with no evidentiary role
  4. R/Python again for the final, reproducible figure

The mockup can shorten a design conversation. The code and run record establish what the final figure says. Keeping those roles separate is what makes the workflow useful for research.


Prompts and Code: Example prompts and comparison code available by request. Contact [email protected].


Citation

Cholette, V. (2025, December 20). Prototype research graphics with Antigravity, then rebuild in code. Too Early To Say. https://tooearlytosay.com/research/methodology/ai-research-graphics-antigravity/

Suggested Citation

Cholette, V. (2025, December 20). Prototype research graphics with Antigravity, then rebuild in code. Too Early To Say. https://tooearlytosay.com/research/methodology/ai-research-graphics-antigravity/
Copy citation