Automating Editable Research Figures with Codex and Visio

The article explains how researchers can replace tedious manual Visio work by prompting Codex to generate PowerShell/VBS/Python scripts that use Visio's COM interface to produce fully editable .vsdx files, covering setup, step‑by‑step usage, advanced tricks, limitations, and real‑world experience.

Old Meng AI Explorer
Old Meng AI Explorer
Old Meng AI Explorer
Automating Editable Research Figures with Codex and Visio

Core workflow: Codex generates a script that drives Visio through its COM interface and saves a native .vsdx file

The process consists of three deterministic steps:

Provide a natural‑language description of the desired diagram (no coding knowledge required).

Codex analyses the description and emits a script in PowerShell, VBS, or Python that calls Visio’s COM objects to create shapes, arrows, and text at explicit coordinates.

The script runs automatically; Visio opens, draws the elements, and saves the document as an editable .vsdx file.

Example: Convolutional neural network architecture

Help me draw a convolutional neural network diagram: input layer 224×224 image, then a convolution layer (64 3×3 kernels), ReLU activation, max‑pooling, two fully‑connected layers, output 10 classes

Example script for a user‑login flow diagram

# Create Visio application instance
$visio = New-Object -ComObject Visio.Application
$docs = $visio.Documents
$doc = $docs.Add()
$page = $doc.Pages.Item(1)
$start = $page.DrawOval(1,7,2,8)
$start.Text = "Start"
# ... intermediate shapes omitted ...
$page.DrawLine(2,7,2,6)
$doc.SaveAs("C:\output\login_flow.vsdx")
$visio.Quit()

Opening login_flow.vsdx in Visio shows each shape as an independent object that can be selected and edited.

Reconstructing figures from paper screenshots

A community‑maintained Skill pengjunchi0/codex-visio-paper-figure-skill (GitHub) accepts an image of a published figure, extracts boxes, arrows, and text, and generates a matching .vsdx file.

Clone the repository into ~/.codex/skills/:

git clone https://github.com/pengjunchi0/codex-visio-paper-figure-skill.git ~/.codex/skills/codex-visio-paper-figure-skill

Open the Codex App and upload the reference image.

Run the command $codex-visio-paper-figure followed by a natural‑language description of any style changes, e.g.:

Rebuild this figure as an editable Visio file. Keep the layout, change the font to Times New Roman, colors to dark blue and gray, arrows to solid lines.

The generated .vsdx retains the original layout while allowing further tweaks inside Visio.

Handling vertical Chinese text

If Visio mis‑orients vertical text, Codex detects the issue and rewrites the script to use a horizontal text box with a rotation transform, ensuring correct rendering.

Advanced uses

Custom style templates

Save a Visio template ( .vssx) that defines colors, fonts, and shape stencils, then instruct Codex to use it:

Use my thesis template.vssx to draw this diagram, font Times New Roman 12pt, boxes light blue fill with dark blue border, lines 1pt solid.

Batch generation

Provide a list of diagram specifications in a single prompt; Codex creates separate scripts and produces multiple consistent .vsdx files. Example prompt:

Generate three Visio diagrams using the thesis template:
1. Encoder‑decoder architecture, input sentence, output label.
2. Data preprocessing pipeline: raw corpus → tokenization → vectorization → train/test split.
3. Experiment workflow with three groups A/B/C, each with inputs and outputs.

Embedding Python‑generated plots

Combine data‑driven Matplotlib charts with Visio structure by having Codex insert saved PNGs into placeholder shapes:

Draw an experiment comparison Visio file:
- Top: large structure diagram showing our method vs baseline.
- Bottom left: line chart from results.csv column "accuracy".
- Bottom right: bar chart from results.csv column "precision_recall".
Use Matplotlib to save the charts and insert them into Visio.

Limitations and work‑arounds

Windows + Visio requirement : The COM interface is Windows‑only. macOS users can run Visio in a virtual machine (Parallels, VMware Fusion, VirtualBox) or use a dual‑boot setup.

Complex diagrams may contain errors : AI reconstruction of intricate network or pathway diagrams is not 100 % accurate; the output should be treated as a starting point and manually fine‑tuned.

Visio license : A full desktop Visio license is required because the COM API is unavailable in the web version.

Alternative approaches include generating SVG/PNG with Python libraries (matplotlib, plotnine, networkx) and importing the vector graphics into Visio, which preserves partial editability.

Real‑world experience

In an AI paper, a seven‑box architecture diagram was generated in seconds. Adding an input node and rotating an arrow required editing two lines in the PowerShell script. Changing the entire color scheme involved modifying a single color parameter and re‑running the script, completing the update in about 30 seconds. This demonstrates that code‑driven diagramming yields faster iteration and reproducibility for researchers comfortable with programming.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PowerShellCodexresearch automationVisioAI‑generated diagramsCOM interfaceeditable .vsdx
Old Meng AI Explorer
Written by

Old Meng AI Explorer

Tracking global AI developments 24/7, focusing on large model iterations, commercial applications, and tech ethics. We break down hardcore technology into plain language, providing fresh news, in-depth analysis, and practical insights for professionals and enthusiasts.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.