Origin Plot Factory is a Windows automation engine for scientific figures that must stay editable in OriginPro. It treats an exported picture as only one part of the deliverable: the source data, native plot bindings, saved project, cold-reopen result, and final PNG/SVG are verified as one transaction.
The rule: a file existing on disk does not mean the figure succeeded.
| Typical plotting script | Origin Plot Factory |
|---|---|
| Stops when a PNG appears | Closes and cold-reopens the saved OPJU |
| May embed a finished image | Requires native Origin plot objects |
| Trusts worksheet assignment | Audits plot-to-column bindings |
| Retries opaque COM errors | Records deterministic failure evidence |
| Relies on default export settings | Checks DPI, SVG vectors, physical size, fonts, and palette |
| Discovers APIs during delivery | Uses prequalified chart recipes for a five-minute target |
One render produces a self-contained evidence package:
regional-trend/
├── regional-trend.opju # native-editable Origin project
├── regional-trend.png # publication export, normally 600 dpi
├── regional-trend.svg # vector export; embedded images rejected
├── normalized-input.csv # exact data accepted by the renderer
└── render-audit.json # bindings, dimensions, hashes, timing, gates
flowchart LR
A["Excel / CSV"] --> B["Schema + semantics"]
B --> C["Normalized data"]
C --> D["One owned Origin session"]
D --> E["Native plots + bindings"]
E --> F["Save and close"]
F --> G["Cold reopen"]
G --> H["Cell + binding mutation"]
H --> I["PNG / SVG export"]
I --> J["Physical + visual audit"]
The pipeline deliberately keeps validation outside the happy path. Invalid fields, missing values, duplicate keys, infinities, and unsafe matrix dimensions are rejected before Origin starts.
The source tree currently contains fixed render paths for seven families:
| Family | Native Origin strategy | Public snapshot status |
|---|---|---|
dual_y_bar_line |
column + line on explicit Y axes | locally qualified release |
grouped_bar_error |
separate X / Y / ED bindings | implementation; v2 requalification |
stacked_bar_area |
individual plots, explicit group + cumulative stack | implementation; v2 requalification |
positive_negative_fill |
two area plots with a zero baseline | implementation; v2 requalification |
heatmap |
matrix + native heat-map plot | implementation; v2 requalification |
rainbow_scatter |
native Sphere symbols + continuous colour mapping | implementation and qualification workflow |
quadrant_bubble |
numeric XY + area-scaled Sphere bubbles | candidate workflow |
Statuses are intentionally conservative. A candidate is not called gold merely because it renders once. Local Origin templates and qualification artifacts are not committed because they may contain licensed Origin content or user data.
Requirements:
- Windows 10 or 11;
- OriginPro 2024b, or a compatible version;
- 64-bit Python 3.11;
- a working
OriginExtautomation registration; - administrator elevation only where the local COM registration requires it.
git clone https://github.com/beiming183-cloud/origin-plot-factory.git
Set-Location origin-plot-factory
py -3.11 -m venv .venv
& .\.venv\Scripts\python.exe -m pip install -r requirements-lock.txt
& .\.venv\Scripts\python.exe -m pip install --no-deps -e .Set portable storage locations instead of editing source code:
$env:ORIGIN_FACTORY_ROOT = "D:\OriginPlotFactory"
$env:ORIGIN_PIPELINE_OPERATIONS = "D:\OriginPlotFactory-Operations"
$env:ORIGIN_TEMPLATE_LIBRARY = "D:\OriginTemplateLibrary"The qualified base.opju, registry, theme, and recipe assets must be installed under ORIGIN_FACTORY_ROOT before a production render. This repository publishes the reusable engine and qualification methodology, not proprietary Origin assets.
& .\.venv\Scripts\draw-origin.exe render `
--chart dual_y_bar_line `
--data "D:\results.xlsx" `
--sheet 0 `
--theme competition-v1 `
--name "regional-trend" `
--strict--strict enables the binding-mutation gate: a source value or label is temporarily changed, the figure response is observed, and the original value is restored before final export.
A chart version may be promoted only after all of these gates pass:
- schema and semantic-contract validation;
- two genuinely different datasets;
- minimum and maximum supported sizes;
- invalid-input rejection before Origin startup;
- native-object and source-binding inspection;
- save, clean exit, and cold reopen;
- worksheet or matrix cell comparison;
- binding mutation and restoration;
- 600 dpi PNG and vector-only SVG export;
- SVG physical size, font, palette, and viewBox checks;
- actual visual inspection at publication size;
- ten consecutive successful runs with no residual Origin process;
- P95 end-to-end duration below 300 seconds.
The most recent complete local engine regression passed 82 tests. The public, asset-free snapshot passes 53 tests with one expected skip for the local release record. GitHub Actions runs this portable suite because hosted runners do not include OriginPro or qualified template assets.
# Portable tests (also used by CI)
python -m pytest -q
# Full local suite (requires configured Origin assets)
python -m pytest -q- Native first: never put PNG/SVG into OPJU as a substitute for a plot.
- One task, one Origin strategy: do not mix
originpro,Application(), andApplicationSI()in one task-owned session. - No blind retries: classify the failure, record evidence, then choose whether retry is safe.
- Immutable releases: candidate and gold directories stay separate; released versions are not edited in place.
- No silent overwrite: user projects are never overwritten by default.
- Production is boring: API discovery and template development happen before the timed render.
origin_pipeline/ input contracts, renderers, session safety, audits, CLI
tests/ portable contracts and local Origin regressions
tools/ portable setup and qualification helpers
docs/ failure lessons, palette policy, and project artwork
- fixed-schema rendering engine;
- cold-reopen and binding-mutation audit;
- native Sphere highlight validation;
- SVG physical-dimension and palette gates;
- finish v2 requalification for four corrected page-size templates;
- publish synthetic, redistributable example template packages;
- expand the audited legacy inventory into fixed renderer families;
- document cross-version OriginPro compatibility.
Reproducible OriginPro behaviour reports are especially valuable: plot bindings, matrix workflows, export dimensions, COM lifecycle issues, and cross-version differences.
Please use synthetic data and do not attach confidential datasets or proprietary .opju projects to public issues. See CONTRIBUTING.md and SECURITY.md.
If this project saves you from a broken editable figure, consider leaving a ⭐ — it helps other OriginPro users find the work.