Scriptora AI Docs
Figures & Diagrams

Python Figures & Data Analysis

Generate publication-quality charts, diagrams, and tables using the AI-powered Python sandbox.

Scriptora AI includes a Python execution sandbox — a secure Docker container with a full scientific Python stack. Ask the AI to run code, and the resulting figures appear directly in the chat for your review before being added to your paper.

Python execution with inline plot display
Generated chart shown inline in chat with save, download, and expand controls.

Available libraries

LibraryVersionUse case
matplotlib3.10.8Publication-quality plots: line, bar, scatter, heatmap, 3D
seaborn0.13.2Statistical charts: violin, box, regression, pairplot
numpy / pandaslatestComputation and data manipulation
scipy / statsmodelslatestStatistical tests: t-test, ANOVA, regression
scikit-learnlatestML metrics: confusion matrix, ROC curves
graphviz0.21Flowcharts, DAGs, architecture diagrams (SVG output)
pycairo1.29.0Custom vector graphics
reportlab4.4.10PDF figures
Pillow12.1.1Image manipulation
networkxlatestNetwork / graph diagrams

Generating a chart

Simply describe what you want in the chat:

Plot a learning curve showing training and validation loss over 50 epochs.
The training loss decreases from 0.95 to 0.12, and validation loss from 0.98 to 0.21.
Use a clean academic style.

The AI will:

  1. Write the Python code
  2. Execute it in the secure sandbox
  3. Show the chart inline in the chat — you can review it before it's added to your paper
  4. Save it as figures/loss_curve.png in your workspace
  5. Optionally insert the \includegraphics command into main.tex

Reviewing figures in chat

When a figure is generated, it appears as an image card below the tool card:

  • Click the image to expand it to full height
  • ⤢ Expand toggle to see more detail
  • ↓ Download to save locally
  • ↗ Open to view full-size in a new tab

You can then give feedback:

The font is too small and I'd like the colors to be colorblind-safe.
Also change "Training" to "Train loss" in the legend.

The AI regenerates the figure based on your feedback.

Workflow: figure in the paper

Describe it in the chat: "Create a grouped bar chart comparing accuracy across 4 datasets for 3 models."

The figure appears inline. Give feedback if needed until you're happy with it.

Once generated, the figure is automatically saved to figures/ in your workspace — no extra step needed.

Ask the AI: "Add this figure to the Results section with an appropriate caption." Or add it manually with \includegraphics{figures/chart_name}.

You don't need to call plt.savefig() manually. The sandbox intercepts plt.show() and saves the figure automatically to figures/. Just call plt.show() at the end of your plot code.

Graphviz flowcharts and DAGs

For architecture diagrams and flowcharts, graphviz produces clean vector SVG output:

Create a system architecture diagram showing: Data Collection → Preprocessing →
Feature Extraction → Model Training → Evaluation.
Use a left-to-right layout with blue boxes.

The AI uses the render_diagram() helper:

import graphviz as gv
dot = gv.Digraph(graph_attr={'rankdir': 'LR', 'bgcolor': 'white'})
dot.attr('node', shape='box', style='filled', fillcolor='#dbeafe', fontname='Helvetica')
dot.node('A', 'Data Collection')
dot.node('B', 'Preprocessing')
dot.node('C', 'Feature Extraction')
dot.node('D', 'Model Training')
dot.node('E', 'Evaluation')
dot.edges(['AB', 'BC', 'CD', 'DE'])
render_diagram(dot, 'pipeline', fmt='svg')

The resulting .svg is saved to figures/pipeline.svg and can be included in LaTeX with \includegraphics{figures/pipeline}.

LaTeX tables from data

The AI can compute statistics and generate properly formatted LaTeX tables:

Analyze this data and create a LaTeX table with mean, std, and 95% CI
for each group: Group A: [82, 85, 79, 88, 91], Group B: [71, 74, 68, 77, 73]

The AI returns a ready-to-paste tabular environment.

Statistical analysis

Run significance tests and other computations:

Perform a two-sample t-test between these two groups and report the
t-statistic, p-value, and confidence interval.
Group 1: [45.2, 47.8, 43.1, 48.9, 46.5]
Group 2: [38.4, 41.2, 39.7, 42.1, 40.8]

The output is reported as text (not an image) that you can paste directly into your Results section.

Security and limits

  • Network disabled: the sandbox has no internet access
  • Timeout: 60 seconds per execution
  • Memory: 1 GB RAM limit
  • Storage: figures are automatically cleaned up after saving to your workspace

The sandbox resets between executions — variables and data from one call are not available in the next. Structure your code to be self-contained, or ask the AI to combine multiple steps into one call.

On this page