SciFigure Studio: Creating Reproducible Scientific Figures with DeepSeek Harness

Introduction

In the DSH plugin ecosystem, most mapping tools are one-line template generators: you drop data into them, and they produce a static image; parameters can only be tweaked by rewriting the prompt. This isn’t enough for scientific writing, because the final output must be the figure within the paper, not just a description in the session; furthermore, chart standards (font size, column width, color bar ticks, data source footnotes) must be directly visible and editable on the figure.

SciFigure Studio is a DSH client plugin maintained by wzgytuA888, positioned as an interactive SCI single-figure workbench: it generates a draft based on data in the chat, then enters a full-page workbench to real-time adjust projection, grid lines, legend, color scheme, and axes, while simultaneously producing a standalone Python script for each figure. It handles single figures only and does not provide compositing, merging, or library functions.

The introduction below is based on the repository README and directory page information; commands and configuration items are taken from the original text.

Positioning & Scope

In short, this is a tool that “transfers matplotlib / cartopy rendering parameters into the plugin workbench”: the front end is the chat and UI, the back end is the repository’s built-in Python rendering engine, and the middle is spec.json carrying the parameters.

Boundaries worth clarifying first:

  1. Only single figures. Map/study area charts, bar/line/scatter/heatmap/box plots are each one figure; no multi-subplot compositing, no figure group management.
  2. Two-layer output: The preview image on the interface, and components/<id>/component.py (a runnable script consistent with the engine rendering).
  3. Requires local Python ≥ 3.10 and pre-installed plotting dependencies. This is not a zero-deployment plugin.

The repository is categorized as Client (客户端), requiring a Web or Desktop Harness to see the workbench interface.

Core Features

Maps & Statistics Charts

Capability Details
Map Cartopy projection switching (11 types: Cylindrical Equidistant / Mercator / Lambert Conformal / Albers Equal Area / Robinson / Molleweide / Equirectangular / Orthographic / Polar Stereographic); central meridian and standard parallels, preset ranges, grid lines (spacing / DMS format / orientation); layers (borders / provincial borders / coastlines / lakes / rivers / South China Sea inset); color bar, scale bar, compass; markers / bubbles / graduated coloring
Statistics Line charts (multi-series / dual-axis), Bar charts (grouped / stacked), Scatter plots (fit lines and equations), Heatmaps, Box plots; axes, legend auto-avoidance, line styles, value labels
Palettes 33 built-in palettes (Categorical: 16, Sequential: 8, Diverging: 9). Categorical colors for lines/bars/scatter, sequential colors for continuous fill and color bars, diverging colors for positive/negative
Journal Specs 7 journal presets (General SCI / Nature / Science / Elsevier / IEEE / Acta Geographica Sinica / Remote Sensing of China); single column 89mm / double column 180mm; font size 6–9pt; ticks facing inward; unified color bar decimal places; data source footnotes; subplot numbering
Tools Auto-recognition by chart type (Map / Statistics / General) showing only relevant parameters; 250ms debounce real-time redraw; Undo / Redo

Three Modification Paths

  1. Manual adjustment via UI tools (Suitable for precise control).
  2. “One-line patch”: Describe in Chinese what to change, and the plugin parses it into a parameter patch, e.g., “Move legend to bottom right, font size to 8”, “Switch to Mercator projection”, “Use palette set 3”.
  3. Direct adjustment on the Agent side using the scifig tool (Suitable for scripting and batch processing).

All three paths ultimately land on the same parameter table, so changes made in the UI and changes made by the Agent affect the same spec.

Code as Output

Every figure corresponds to a component.py. Parameters are written in the script, and parameters and rendering results are consistent with the workbench. It can be run directly with python component.py --out x.png or used for further editing. This is crucial for scenarios requiring reproduction of figures in submission environments (different machines, different Python versions).

Sessions & Workspace

The workbench supports switching sessions and continuing to adjust figures generated in historical conversations. Workspace deletion supports three granularities: single figure / single session / all; “all” requires an explicit confirm.

Installation & Enabling

Environment Preparation

Requires DeepSeek Harness (Web/Desktop), Node ≥ 20, and Python ≥ 3.10. Install dependencies on the Python side:

pip install matplotlib cartopy geopandas shapely pyproj pandas numpy pillow scipy adjustText

Note that Cartopy will download Natural Earth basemaps on first use; offline environments need the Cartopy data directory pre-configured. Chinese rendering requires the system to have SimSun, SimHei, or Microsoft YaHei installed.

Installing the Plugin

Use Harness’s plugin manager to install the local bundle directory:

plugin_manager install_bundle  target = <local repository directory>

Or place the repository in ~/.dsh/plugins/ and insert into the profile’s cordis.patch.yml:

- insert:
    - id: scifig-studio
      name: 'dsh-scifig-studio'

Configuring Python

The repository contains no hardcoded machine paths. The Python interpreter and output directory are configured via one of the following methods, with priority decreasing until falling back to PATH.

  1. Plugin config:
config: { python: '/path/to/python', workDir: '/path/to/figures' }
  1. Environment variables:
SCIFIG_PYTHON=/path/to/python
SCIFIG_WORKDIR=/path/to/figures
  1. Create .scifig-config.json under the plugin directory (already in .gitignore):
{ "python": "C:\\venvs\\scifig\\Scripts\\python.exe" }

If none are configured, it falls back sequentially to <bundle>/.venv/… and the python found in PATH.

Enabling

After installation, the “Scientific Mapping” icon appears in the left taskbar, and the scifig tool appears on the Agent side. Refresh the page after modifying client.js for changes to take effect; modifying host-side logic requires disabling and re-enabling the plugin.

Typical Usage

Usage 1: Requesting in Chat

Draw a map of Xinjiang soil salinity spatial distribution using samples/map_points.csv, with point symbols graded by salinity value. Add grid lines, scale bar, and compass. Color bar unit dS m⁻¹, Nature style, double column.

The Agent calls scifig{draft} to generate a draft, and the tool card displays a thumbnail. Next, click “Scientific Mapping” in the left taskbar to enter the full-page workbench, which has Preview and Code tabs; in the tools area, map parameters like projection chips, grid lines, color bars, and scale bars are displayed, while statistics parameters like axes and legends are shown. Changes trigger real-time redraw. Finally, you can patch with a one-line command, export PNG, copy paths, or view code.

Usage 2: Directly Calling Tools on the Agent Side

{ "action": "draft", "dataFile": "samples/map_points.csv", "kind": "map",
  "description": "Xinjiang soil salinity spatial distribution, graduated coloring, 5-degree grid lines, scale bar + compass, Nature double column" }

{ "action": "patch", "set": { "map.projection": "mercator", "style.palette": "ppt-03",
                              "map.colorbar.palette": "ppt-17", "legend.position": "lower right" } }

{ "action": "nl", "text": "图例放右下角,字号调到 8" }
{ "action": "export" }        // Export PNG
{ "action": "code" }          // Get standalone Python code
{ "action": "delete", "mode": "figure" }   // mode=all requires confirm:true

Usage 3: HTTP API

The plugin exposes a set of interfaces under the same-origin /scifig prefix: health, controls, palettes, state, sessions, patch, nl, preset, image, export, download, active, code, workspace/delete. You can use curl directly for local self-check:

curl http://127.0.0.1:3080/scifig/api/health
curl -X POST http://127.0.0.1:3080/scifig/api/patch \
  -H 'content-type: application/json' \
  -d '{"figureId":"fig-...","set":{"map.projection":"robinson"}}'

A reminder: endpoints like compose, decompose, and library (compositing) have been removed; calling them will return “Function removed”. This is consistent with the plugin’s positioning of “only doing single figures”.

Custom Palettes

py/scifig/palettes.json is the source of palette data, with fields like kind: categorical | sequential | diverging. You can extract a new set from your own PPTX:

python scripts/extract_palettes.py "my-deck.pptx" \
    --out py/scifig/palettes.json --preview out/palettes-preview.png

Local Self-Check After Code Changes

npm run check:client              # Node syntax
python -m compileall -q py/scifig # Python syntax
python py/tools/selftest.py --mode samples
powershell -ExecutionPolicy Bypass -File scripts/verify-api.ps1 -Origin http://127.0.0.1:3080

The first three checks syntax and example rendering; the last is the interface acceptance script covering 45 endpoints, suitable for running after modifying the host or client locally.

Structure Overview

For those who want to modify the source code, it is important to know that the parameter table is not maintained manually but is generated by the tools.

index.js            Host entry: register tools / HTTP routes / system prompt
client.js           Browser side: left taskbar icon + full-page workbench (preview / tools / code)
host/               Host logic: api / ops / store / render / controls / infer / nl / spec / palettes ...
py/scifig/          Rendering engine: engine / charts / spec / legend / controls.json / presets.json / palettes.json
py/tools/           Engine self-check and resource generators (controls.json, SPEC.md are generated by them)
samples/            Example data and spec
docs/SPEC.md        Full parameter set (124 items) and known limitations
docs/CONTRACT.md    Design contract (Host / Client / Renderer boundaries, API, tool schema)
scripts/            verify-api.ps1 (45 endpoint acceptance), extract_palettes.py (re-extract palettes from PPTX)

The output directory defaults to <bundle>/out:

out/<figureId>/{spec.json, figure.png, history/<rev>.json, meta.json}
components/<id>/component.py     # Standalone: python component.py --out x.png

history/<rev>.json saves a snapshot of each change, corresponding to undo/redo in the tools area.

Use Cases & Notes

Suitable for these types of people:

  1. Need figures for papers but don’t want to write matplotlib/cartopy code from scratch every time.
  2. Need to move figures from the plugin to a submission environment and reproduce them at the code level.
  3. Want to use an Agent to automatically generate figures, then manually fine-tune them in the workbench (hybrid workflow).

Things to note before getting started:

  1. The plugin runs with the current DSH process permissions. Before modifying source code, it is recommended to read docs/SPEC.md, docs/CONTRACT.md, and index.js / client.js to confirm rendering and API boundaries. License is MIT, author wzgytuA888, sample data is synthetic.
  2. Requires Python dependencies and Cartopy basemap downloads; offline or intranet machines need pre-deployment.
  3. Only single figures. If you need multi-subplot layouts, you must handle component.py yourself or use other tools.
  4. The directory page shows 0 stars; this is a new repository, so issues are mainly relied upon for help.

Conclusion

The value of SciFigure Studio lies in breaking “generating a scientific figure” into three separable tasks: Agent setup, UI tuning, and code reproduction. It doesn’t cram mapping functions into a pile of prompt templates but uses spec as a unified parameter carrier and keeps rendering results consistent with the output code. If you only need single figures, this is a client plugin worth trying.

  • Directory Page: https://www.skillhub.cn/plugins/wzgytuA888/scifig-studio
  • GitHub: https://github.com/wzgytuA888/scifig-studio
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye