orz-plotA VS Code custom editor for interactive Plotly charts. Write your chart as JSONC — comments included — and see a live preview side-by-side. GitHub: https://github.com/wangyu16/orz-plot-vscode Author: Yu Wang · yuwang@orz.how Quick Start with an AI AgentYou don't need to learn Plotly JSON by hand. Open the file in VS Code, then ask any AI coding assistant (Claude, Copilot, ChatGPT, etc.):
The agent will write the complete JSONC spec and paste it into your file. Built-in Agent Skills available to guide AI agent work properly with this editor. Tips for AI-assisted charting
Features
Supported Trace Types
Editor UI
File Formats
|
| Need | Syntax | Example |
|---|---|---|
| Superscript | <sup>…</sup> |
"m/s<sup>2</sup>" |
| Subscript | <sub>…</sub> |
"H<sub>2</sub>O" |
| Bold / Italic | <b>, <i> |
"<b>Note</b>" |
| Unicode | plain UTF-8 | "α", "μ", "°C", "→" |
| LaTeX inline | $...$ |
"$k_{\\text{cat}}$" |
| LaTeX display | $$...$$ |
"$$\\frac{dC}{dt}=-kC^2$$" |
| Chemistry | $\\ce{...}$ |
"$\\ce{H2SO4}$" |
Legend Positioning
Common placements for the "legend" key inside "layout":
// Horizontal, centred below the chart ← most common
"legend": { "orientation": "h", "x": 0.5, "xanchor": "center", "y": -0.15, "yanchor": "top" }
// Inside top-left corner of the plot
"legend": { "x": 0.01, "y": 0.99, "xanchor": "left", "yanchor": "top" }
// Inside top-right corner
"legend": { "x": 0.99, "y": 0.99, "xanchor": "right", "yanchor": "top" }
// Hidden
"showlegend": false
Important: Always include
"xanchor": "center"when using"x": 0.5for a horizontal legend, otherwise Plotly places the legend's left edge at the centre and it appears shifted to the right.
Legend style fields: bgcolor, bordercolor, borderwidth, font, title, itemsizing, traceorder.
Included Templates
New empty files open a template gallery. Available templates:
bar · line · scatter · pie · heatmap · histogram · area
Example Files
examples/ contains six ready-to-open .plot.svg charts:
browser-market-share.plot.svggdp-by-region.plot.svggene-expression-heatmap.plot.svgportfolio-performance.plot.svgreaction-kinetics.plot.svgscore-distributions.plot.svg
Development
Requirements: Node.js, npm, VS Code
npm install # install deps
npm run build # compile with esbuild
npm run package # produce orz-plot-0.1.0.vsix
Run in development: open the repo in VS Code and press F5.
Architecture
| File | Role |
|---|---|
src/ChartEditorProvider.ts |
VS Code CustomTextEditorProvider integration |
src/webview/main.ts |
Monaco/editor UI, zoom selector, message bridge |
src/webview/renderer.ts |
Plotly rendering, zoom-based sizing, offscreen export capture |
src/parser.ts |
JSONC extraction and document serialisation |
src/shared/messages.ts |
Host ↔ webview message protocol |
Constraints
plotly-basiconly (no full Plotly)- No JavaScript callbacks in chart config
- No external resource URLs in saved documents
.plot.htmlis the preferred long-term source format;.plot.svgis a supported compatibility format