Images, SVG, and charts
You can place graphics made elsewhere on the canvas as annotations: a screenshot of a spectrum, a logo, an SVG from another program, or a plot of rate data. SVG files keep their vector data and export at full quality at any size. Raster images (PNG, JPEG) can be cropped. Plotly charts come in through a dialog where you paste the chart’s JSON, and become SVG annotations.
SVG annotations
Section titled “SVG annotations”To insert an SVG, select Insert > Image… and select the file. You can select several files at once; each one is inserted at the center of the view, 20 px down and to the right of the one before, so the files arrive as a visible stack. A file is treated as SVG when its MIME type says so or its extension is .svg, and is kept as vector graphics. Every other format is inserted as a raster image.
You can also drop an SVG file anywhere on the canvas, or copy SVG markup to the clipboard and press Ctrl+V.
Molkit parses and cleans the file before inserting it, and malformed SVG is rejected. The cleaning removes:
- scripts, event handlers, and embedded foreign content (HTML inside the SVG)
- links: the linked text or shapes stay, but they are no longer clickable
- anything that loads from the web, such as an image or a font linked by address (images embedded in the file stay)
A style sheet inside the SVG is kept, but it applies only to that SVG, never to the rest of the page. The cleaned markup is stored in the document, so saved files carry the full vector data.
If an imported SVG shows a blank area where a picture should be, the picture was linked by address rather than embedded. Embed it in the SVG (most editors offer this when saving) and import the file again.
Size and aspect ratio
Section titled “Size and aspect ratio”The natural size comes from the viewBox of the SVG (or its width and height attributes). On insertion, the graphic is scaled down if needed so that its longest side is 300 px. You can resize it afterward without loss of quality.
The aspect ratio is locked by default. While it is locked, corner and edge handles both resize proportionally, and typing a new width in the properties panel recalculates the height (and the other way around). To allow free resizing, click the lock button in the panel.
Properties panel
Section titled “Properties panel”When you select an SVG annotation, a panel titled SVG opens, with width and height fields, an opacity slider (0 to 100%), and a border toggle with width and color controls. The border is drawn as a rectangle just outside the graphic.
SVG annotations cannot be cropped; cropping is for raster images only.
Raster images
Section titled “Raster images”Images in other formats (PNG, JPEG, and other bitmap formats) are inserted as raster annotations in the same ways: Insert > Image… (several files at a time), paste, or drag and drop. See Copy and paste for details on pasting and dropping. Their properties panel has the same opacity and border controls, plus Replace… to swap in a different file and Original Size to restore the natural size of the image.
Cropping raster images
Section titled “Cropping raster images”To crop a raster image:
- Double-click the selected image, or click Crop in its properties panel. Eight handles appear around the visible area.
- Drag any handle to crop. The image updates as you drag.
- To finish, press Enter or Esc, or click outside the image.
While you crop:
- Handles snap to the detected edges of the image content, so a single drag can trim surrounding white space.
- Holding Shift on a corner handle locks the aspect ratio, and holding Shift on any handle turns off snapping to the content edges.
- Pressing Esc during a handle drag cancels that drag, so the image returns to its crop from before the drag. Enter keeps the crop as dragged.
To restore the full image, click Reset Crop in the panel.
Plotly charts
Section titled “Plotly charts”To import a chart, select Insert > Plotly Chart… and paste a Plotly figure as JSON in the text area. The JSON must contain a data array and may include a layout object. A preview renders about half a second after you stop typing; JSON and rendering errors appear in place of the chart.
To place the chart, click Insert or press Ctrl+Enter. Esc closes the dialog, and Tab indents in the text area.
What you get
Section titled “What you get”The chart renders once at the size given by layout.width and layout.height (default 700 × 450), and its layered SVG output is merged into a single SVG annotation. The result behaves like an imported SVG: vector scaling, opacity, border, and the aspect ratio lock all apply. The graphic is a static snapshot: hovering, zooming, and panning do not work on the canvas.
The original JSON is stored with the annotation. To change the chart, double-click it, right-click it and select Edit Chart…, or click Edit Chart… in its properties panel. The dialog opens with your JSON; edit it and click Update to regenerate the graphic in place.
Limits
Section titled “Limits”- Plotly.js loads from a CDN when first needed, so the first import in a session needs an internet connection.
- Only the SVG output of Plotly is captured. Trace types that Plotly draws with WebGL render to a canvas element and do not appear in the imported graphic.
- Charts are rebuilt from the JSON on each edit. Interactive elements in the JSON (buttons, sliders) have no effect in the static snapshot.
See also
Section titled “See also”- Shape Properties panel
- Export an SVG
- Double-click shortcuts, for every double-click target