---
title: "Run Your Own Python Script on Invert Data"
slug: python-trend-report-grid
url: https://invertbio.com/docs/assist-use-cases/python-trend-report-grid
keywords: ["assist","use case","python","script","matplotlib","code block","report","CHO","metabolites","trend report","template"]
---

# Run Your Own Python Script on Invert Data

Your group has a 300-line matplotlib script that draws the house-style trend grid. Paste it into Assist and it runs inside an Invert report, against live run data, without rewriting a line by hand.

> Bring your own scripts or write new ones with Assist, and save them for reuse.

## The problem

Upstream PD has a trend report everyone recognizes: header band with logo and run details, nine panels (VCD, viability, glucose; lactate, glutamine, ammonium; titer, offline pH, osmolality), shaded control ranges, one line per bioreactor. It lives in a script someone runs locally, saves as PNG and pastes into a slide. The data has to be exported first, the output lives outside Invert, and nobody else quite dares to touch the code.

![The original matplotlib script and its PNG output: a branded 3x3 CHO trend grid](/docs/assist-use-cases/python-trend-report-grid/image-1.png)

## What you do

Attach the script file, or paste the code into the chat:

> _"Recreate this 3x3 line chart grid inside a report code block."_

## What Assist does

1.  **Reads the script as a whole**: layout, brand colours, control bands, panel codes, header and footer, and keeps all of it. The point is to reproduce your template, not redesign it.
2.  **Makes it work inside a report**: a script written to run on a laptop and save a file is not quite the same as one that draws a chart inside Invert. Assist makes those small adjustments for you and tells you what it changed and why.
3.  **Creates the report and the code block**, runs it and confirms it executed cleanly. The figure renders inline; the code stays editable beside it.
4.  **Offers the next step**: swap the script's sample data for real Invert runs so the grid plots live process data, and save the template as a Skill so anyone can ask for "the USP trend report for campaign X" without seeing the code.

![The same grid rendered as a code block inside an Invert report, with Assist's summary of what it changed](/docs/assist-use-cases/python-trend-report-grid/image-2.png)

## Why it matters

-   **Your script, where your data is.** No exports, no PNGs; the grid draws from the runs in Invert.
-   **Nothing lost in translation.** Brand, layout and control ranges carry over exactly.
-   **From one owner to the whole team.** Saved as a Skill, the report is one sentence away for everyone.

## Example prompts

-   _"Adapt this template to plot the three BR runs from campaign USP-26-031 instead of sample data."_
-   _"Save this branded trend-grid template as a reusable Skill."_
-   _"Add a fourth row with DO, pCO2 and base addition."_

## Related guides

-   [Assist](/docs/user-guides/assist)
-   [Reports](/docs/user-guides/reports)
-   [Skill example: Turning a Visualization into a Template](/docs/assist-use-cases/skill-trend-report-template)
