MATLAB · chapter 8 of 13

Figures

Every plotting function returns a figure handle and follows one house style (palette, typography, tick and grid styling). Pair them with grn.exportFigure for publication output.

Networks: grn.plotNetwork

fig = grn.plotNetwork(model) accepts a model, a solution, a screen (anything with a field S), or a signed adjacency. It draws the network in pathway notation:

OptionDefaultMeaning
Layout"auto""circle" (up to 12 genes), "force" (beyond), or "layered" with regulators above targets
Labelstrue up to 60 genesShow gene labels
Curvature0.12Edge bend as a fraction of edge length (reciprocal edges bend at least 0.22)
Axesnew figureDraw into an existing axes, for your own tiled layouts
Title, LegendtrueShow the title line and the activation/repression key
Seed1Seed for the force layout
fig = grn.plotNetwork(model, Layout = "layered");
grn.exportFigure(fig, "network.pdf");           % vector
One 12-gene network in the three layouts. Circle keeps every node visible; force pulls connected genes together; layered puts regulators above their targets.
One 12-gene network in the three layouts. Circle keeps every node visible; force pulls connected genes together; layered puts regulators above their targets.

grn.plotMotifs() draws all ten registered motifs; grn.plotMotifs(["toggle", "repressilator"]) a subset. Options Columns (5) and Size (4, for cascade and sim).

Expression data: grn.plotExpression

fig = grn.plotExpression(sol, ...) shows a solution as line traces (all genes up to MaxLines, otherwise the most variable ones) over a genes-by-time heat map. When the solution has several cells, the chosen cell is drawn in full and the others as faint traces behind it. When a stimulus was applied, a top panel shows the input.

OptionDefaultMeaning
Cell1Which cell to draw in full
MaxLines12Maximum number of traces
OverlaytrueDraw the other cells faintly (up to 50 cells)
Species"protein""protein" or "mrna" for two-stage models

Export: grn.exportFigure

grn.exportFigure(fig, filename) applies the house style and writes the file. .png, .jpg, .tif are rasterised at Resolution dpi (default 300); .pdf and .eps are true vector graphics. Style = false skips the restyling.

grn.exportFigure(fig, "figure3.png", Resolution = 600);
grn.exportFigure(fig, "figure3.pdf");

Headless sessions (matlab -batch) work; the style forces a light theme so exports do not inherit the dark desktop theme of recent releases.

Building your own figure

The style constants are available for custom plots:

st = grn.internal.style();     % st.colors (7 x 3), st.gray, st.fontName, st.lineWidth, ...
fig = figure(Color = "w");
ax = axes(fig); hold(ax, "on");
plot(ax, sol.t, sol.x(:, 1), Color = st.colors(1, :), LineWidth = st.lineWidth);
grn.plotNetwork(model, Axes = axes(fig, Position = [0.7, 0.6, 0.28, 0.35]), Title = false, Legend = false);
grn.exportFigure(fig, "custom.pdf");

grn.internal.applyStyle(fig) restyles any figure in place.

A custom figure: house-style traces with the network drawn into an inset axes through the Axes option.
A custom figure: house-style traces with the network drawn into an inset axes through the Axes option.