FigSpace is a figure composition plugin for Fiji. It continues the FigureJ workflow with an expandable canvas, panels positioned in millimetres, and content providers for images, text, and scripts. Figures can be saved as editable layouts and exported as layered SVG files.
| Project | Details |
|---|---|
| Source | github.com/mutterer/FigSpace |
Features
- Draw, move, and resize panels using physical dimensions.
- Split panels into nested rectangles and align or distribute multiple panels.
- Combine source images, Markdown text, solid colors, and scripted content.
- Add panel labels and image scale bars.
- Coordinate image views across linked FigureJ panels and reuse display settings or lookup tables (LUTs).
- Automate layouts with ImageJ macros and the integrated FigScript editor.
- Save figure layouts as XML and export SVG for further editing.
Most features are introduced with examples in the FigSpace testing announcement on the Image.sc Forum.
Requirements and installation
FigSpace requires Fiji with Java 11 or later. Check the Java version used by Fiji, since it can differ from the Java installed for other applications.
Recommended: Fiji update site
Install FigSpace through its Fiji update site to receive plugin updates through the Fiji Updater.
- Open Help › Update… in Fiji.
- Click Manage update sites, search for FigSpace, and enable its checkbox once the site is available in the list.
- If FigSpace is not listed, click Add Unlisted Site. Enter FigSpace
as the name and
https://sites.imagej.net/Fig-Space/as the URL. Ensure the site is enabled. - Close the update site dialog and click Apply changes.
- Restart Fiji, then launch FigSpace from the Plugins menu.
See Following an update site for the updater workflow.
Alternative: manual installation
For a manual installation, place the FigSpace plugin JAR in Fiji’s plugins
directory and ensure its runtime dependencies are available, then restart Fiji.
The plugin uses Appose, RSyntaxTextArea, Flexmark (including tables and
strikethrough extensions), Flying Saucer, and Batik SVG generation.
Launch FigSpace from Fiji’s Plugins menu. Additional content providers can require separate provider JARs, update sites, or external environments. Check the warning on the empty canvas for update sites needed by optional features.
Quick start
- Launch FigSpace from Fiji’s Plugins menu.
- Draw a rectangular panel on the canvas.
- In Item Properties, select FigureJ Panel Selection as its Type.
- Choose a Source Image File and click Render.
- Move or resize the panel. Use X, Y, Width, and Height for precise geometry in millimetres.
- Add more panels and enter their labels, such as A, B, and C.
- Use Save to preserve the editable XML layout, then Export SVG to create the figure for downstream editing.
Click Help! on the canvas for the help bundled with the installed version.
Figure layout
The Figure section contains DPI, Nudge, Preview, and Reset View. Nudge sets the keyboard movement step. Preview enables a lightweight view while adjusting the layout; Reset View fits the figure panels into the viewport.
To subdivide a panel, select it, set Num in Nested Rects, and use a horizontal or vertical split. The remove button removes a selected nested rectangle. The panel context menu provides Panel Geometry actions to copy and paste dimensions, align panels, and distribute them. Alignment needs at least two movable panels. Distribution needs at least three.
Use the lock beside the width and height fields to preserve a panel’s aspect ratio while resizing. Hold Shift while drawing or dragging a corner to make a square. Ctrl-click panels to extend or toggle the selection, or Ctrl-drag a selection rectangle. Use the arrow keys to nudge the selection. Pan with a middle-button drag, Alt-drag, or Space-drag.
Panel content
Choose a panel’s Type in Item Properties. Its provider-specific controls appear below. Click Render after changing content settings.
| Content | Use |
|---|---|
| FigureJ Panel Selection | Select and render a region from a source image. |
| Active Image | Assign the current ImageJ image, including through a macro. |
| Text | Render Markdown within a panel. |
| Plain Color | Fill a panel with a solid color. |
| IJ Macro | Generate panel content using an ImageJ macro. |
| Matplotlib | Generate plots using Python through Appose. |
| R Script | Generate content using an R script. |
| Page | Define a page rectangle for organizing the figure. |
The available providers depend on the installation. External provider examples in the project include napari, Vizarr, BigVolumeBrowser, interactive 3Dscript, Sine Wave, and OMERO. They are separate from the core Maven build.
Pages
Use the Page type to place a white page behind content. Set its Title
and choose a Format such as A4, Letter, or a landscape preset marked with
an R suffix. Choose custom to enter a different width and height.
FigureJ source regions
Double-click an image panel to reopen its ViewFinder when supported. Use about panel in the context menu to inspect its metadata and provider properties in the editor.
To mark a detail crop on an overview of the same image, right-click the crop and choose Source Region → Get. On the overview panel, choose Source Region → Highlight to draw the crop outline. Use Source Region → Clear on the overview to remove its outlines.
Text
Select Text, enter Markdown in Text (Markdown), or click Edit to use the editor. Update stores editor changes; Render also refreshes the canvas. Use Text color and Orientation (degrees) to style and rotate the text. Positive angles rotate clockwise. Click Render to apply the changes to the canvas and SVG export.
Supported formatting includes headings, bold, italic, strikethrough, nested lists, inline code, fenced code blocks, blockquotes, hyperlinks, horizontal rules, and pipe tables. Insert a Markdown line break with two trailing spaces or a backslash at the end of a line. Raw HTML and embedded images are unsupported.
Text wraps to the panel width and is clipped at its height. Resize and render again to reflow it. Rendering captures the current ImageJ font settings; sizes are interpreted in points. SVG export keeps styled text editable, with fixed positions for wrapped lines and styled runs. HTTP(S), mailto, and fragment links retain their targets in the SVG.
Labels, scale bars, and image views
Use the ImageJ foreground color and font settings when preparing labels and scale bars. For FigureJ panels, a scale bar slider value of zero hides the bar; increasing it creates a bar using the current foreground color. To change an existing bar’s color, set the slider to zero, choose the new foreground color, and increase the slider again.
Right-click a panel to copy or paste label styles, display settings, or LUTs. Display settings and LUTs can be applied to compatible panels in a multi-selection; panels with a different channel count are skipped. link coordinates ViewFinder geometry across selected FigureJ panels; unlink removes links. uncrop and split channels appear when supported by the selected image.
Saving and exporting
Save writes the figure layout as XML; Open reloads it. Keep source images available for workflows that reopen or render them.
Export SVG writes separate layers for panel content, borders, scale bars, and labels. Text panels retain SVG text elements for editing in applications such as Inkscape. Editing an exported text line does not reflow its original Markdown paragraph. Keep the XML layout as the editable FigSpace document.
Macro automation
Running FigScripts
Click Editor, then New FigScript Macro. The first line of the new tab
contains //@FigScript v=0.3.0 for FigSpace 0.3.0. The version is the minimum
required to run the script. Click Run to execute it. FigScripts support
ordinary ImageJ macro functions, loops, and user-defined functions.
Open loads a script into a new tab. Save and File → Save As… write
the active macro tab to disk. Panel code tabs use Update and Render.
The editor executes scripts without a versioned first-line header as standard
ImageJ macros. A malformed version after //@FigScript v= or a requirement
higher than the installed version stops execution.
Open an image in ImageJ, then run this FigScript to create a labeled panel.
//@FigScript v=0.3.0
panel = addPanel("0", "0", "60", "40");
setLabelFont("SansSerif", "12", "bold");
setPanelLabel(panel, "A");
assignImage(panel);
resetView();
Custom macro functions
Coordinates and sizes are in millimetres. Use quoted numeric arguments or
d2s(value, decimalPlaces) for calculated values. Creation functions return
panel IDs as strings. Commands that change the figure or view have no return
value. A command error stops the macro.
The examples use FigScript shorthand. Examples that take panel or page
expect an ID from a creation call. Replace sample file paths with paths on
your system.
| Function | Behavior | Example |
|---|---|---|
addPanel(x, y, w, h) |
Creates and selects a panel, then returns its ID. | panel = addPanel("10", "15", "60", "40"); |
addPage(x, y, w, h) |
Creates and selects a Page of the specified size, then returns its ID. | page = addPage("0", "0", "210", "297"); |
addPage() |
Creates a same-size page 5 mm to the right of the last remaining page in creation order, at the same Y position. With no existing page, creates A4 at the origin. Returns the new ID. | nextPage = addPage(); |
addText(x, y, mdtext) |
Creates a Text panel fitted to the rendered Markdown using the current ImageJ font. Text uses its natural width. Explicit line and paragraph breaks increase the height. Returns the panel ID. | note = addText("10", "60", "## Results\n\n**Control**"); |
addText(x, y, w, h, mdtext) |
Creates a Text panel with the specified bounds and starts rendering. Text wraps to the width and clips at the height. Returns the panel ID. | note = addText("10", "60", "80", "25", "## Results\n\nText wraps within the panel."); |
getPanelIds() |
Returns an array of panel ID strings, including pages. | ids = getPanelIds(); |
getPanelBounds(id) |
Returns numeric bounds in the order [x, y, width, height]. |
bounds = getPanelBounds(panel); |
adjustPanel(id, x, y, w, h) |
Sets the panel position and size. Width and height must be positive. | adjustPanel(panel, "12", "15", "65", "40"); |
setPanelLabel(id, label) |
Sets a panel’s label. | setPanelLabel(panel, "B"); |
setLabelFont(fontName, fontSize, fontStyle) |
Sets the ImageJ font used when creating labels. Use a positive integer size and a style such as plain, bold, italic, or bold italic. |
setLabelFont("SansSerif", "12", "bold italic"); |
assignImage(id) |
Renders the current ImageJ image into the panel using Active Image. | assignImage(panel); |
assignImage(id, filepath) |
Sets a source image file and starts rendering it with FigureJ Panel Selection. | assignImage(panel, "/path/to/image.tif"); |
setView(id) |
Fits a panel or page into the viewport. Pass "0" for the whole figure. |
setView(page); |
setView(id, easing) |
With "true", animates the pan and zoom over 350 ms and waits for it to finish. With "false", fits immediately. |
setView(panel, "true"); setView("0", "true"); |
resetView() |
Fits the whole figure into the viewport. | resetView(); |
exportFigure(svgpath) |
Exports the current figure. Appends .svg if needed and overwrites an existing file at that path without prompting. |
exportFigure("/path/to/figure.svg"); |
clearFigure() |
Clears all panels, guides, and figure settings without prompting. Macro tabs stay open. | clearFigure(); |
For example, use the numeric bounds to shift a panel while keeping its size.
//@FigScript v=0.3.0
panel = addPanel("10", "15", "60", "40");
bounds = getPanelBounds(panel);
adjustPanel(panel, d2s(bounds[0] + 5, 6), d2s(bounds[1], 6),
d2s(bounds[2], 6), d2s(bounds[3], 6));
setView(panel, "true");
Calling FigSpace from standard ImageJ macros
Use ImageJ’s call(...) with the fully qualified method name. Both query
methods return semicolon-delimited strings through this interface. Split the
strings to get the IDs or bounds, then convert bounds with parseFloat(...)
before doing arithmetic.
api = "org.figspace.Fig_Space_.";
panel = call(api + "addPanel", "10", "15", "60", "40");
ids = split(call(api + "getPanelIds"), ";");
bounds = split(call(api + "getPanelBounds", panel), ";");
width = parseFloat(bounds[2]);
call(api + "setPanelLabel", panel, "A");
call(api + "resetView");
print("Width in mm: " + width);
The repository includes two examples in src/macros.
Fig_Space_Sample_Layout.ijmcreates a five-panel figure from an image directory. SetimageDirectoryto an existing folder of source images.Stack_To_Panel_Array.ijmuses an open stack with one channel and one time point to lay out every selected slice step in a grid. Keep the temporary slice TIFFs it creates if you need to reopen or rerender the figure. The bundled script checks for the olderassignImagereturn value. With FigSpace 0.3.0, usecall(className + ".assignImage", panelId, filepaths[index]);in place of that call and itsresult != "true"check.
Extending FigSpace
Developers can implement org.figspace.FigureContentProvider and register their
class in META-INF/services/org.figspace.FigureContentProvider. Provider
properties define the controls shown in Item Properties and are persisted
with panels, so property keys should remain stable between versions.
OMERO connector
Romain Guiet (EPFL) developed the optional OMERO connector for FigSpace. It lets you bring images and metadata directly from an OMERO server into a figure. The connector is distributed as a separate provider JAR and uses the Java gateway bundled with OMERO.imagej in Fiji.
- Choose OMERO as the panel type. Enter the server, port (4064 by default), user name, and numeric image ID. Click Render and enter your password when prompted.
- Browse the image in Fiji’s virtual hyperstack, which fetches planes on demand. Use the channel controls to adjust visibility, LUTs, and display ranges, then confirm the crop in the ViewFinder to store the selection, Z slice, time point, and display settings in the panel.
- Use split channels to create separate channel panels or link to synchronize views across related panels. Scale bars use the physical pixel size recorded in OMERO when available.
The Import OMERO metadata menu creates editable Text panels from image tags, key-value pairs, or channel names. The provider’s Content control can also display metadata directly in an OMERO panel.
Matplotlib connector
Try any example from either gallery in a FigSpace panel. Choose Matplotlib as the panel type, click Edit beside Code, and paste the example’s Python code. Click Render to put the plot on the canvas. Once it renders, swap the example data for your own or adjust the labels and styling. Matplotlib gallery · Seaborn gallery
On first use, Appose builds FigSpace’s managed Python 3.10 environment. It
includes Matplotlib and Seaborn for plotting, NumPy for arrays, pandas for
tabular data, scikit-image for image processing, Requests for HTTP, and
qrcode for generating QR codes. The shared environment also includes the
Python Appose package, pip, and rpy2 for R integration.
FigSpace renders the current Matplotlib figure to the panel and includes an SVG
version of the plot in the figure export. You can omit plt.show() and
savefig(). If an example creates several figures, leave the one you want
active at the end of the script. Examples that use an interactive window,
extra packages, or external data may need adapting. For example,
sns.load_dataset(...) needs network access if the dataset is missing from
the local cache. You can substitute a local CSV with pandas.read_csv(...).
This Seaborn example uses data defined in the script.
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
data = pd.DataFrame({
"Time (min)": [0, 5, 10, 15],
"Intensity": [12, 19, 27, 30],
})
sns.lineplot(data=data, x="Time (min)", y="Intensity", marker="o")
plt.tight_layout()
Citation
The bundled help requests the following reference for FigSpace and related FigureJ workflows:
Mutterer, J. and Zinck, E. Quick-and-clean article figures with FigureJ. DOI: 10.1111/jmi.12069.