Runtime

Tiled layouts

Arrange independent 2D panels in one figure with local and shared titles.

01

Four trigonometric panels

tiledlayout returns the current figure's numeric layout token. nexttile selects panels in 1-based row-major order. title(layout, text) sets a shared title; title(text) labels only the active panel.

Sun
layout = tiledlayout(2, 2);
title(layout, "Trigonometric Functions");
x = linspace(0, 30);
nexttile
plot(x, sin(x));
title("Sine");
nexttile
plot(x, cos(x));
title("Cosine");
nexttile
plot(x, tan(x));
title("Tangent");
nexttile
plot(x, sec(x));
title("Secant");
02

Select and replace a panel

nexttile and nexttile() advance to the next panel; nexttile(index) selects an explicit panel. Advancing beyond the grid reports an error rather than wrapping. The first plot without an explicit selection uses panel 1.

Plotting replaces only the active panel. title, xlabel, ylabel, grid, legend and axis apply locally. sgtitle(text) sets the shared title without a token; stale layout tokens are rejected.

Sun
layout = tiledlayout(1, 2);
x = linspace(0, 2*pi);
nexttile(2);
plot(x, cos(x));
title("Cosine");
grid(true);
nexttile(1);
plot(x, sin(x));
xlabel("Radians");
sgtitle("Independent panels");
03

Limits and clearing

  • At most 16 fixed panels, 16 curves and 10000 points globally per figure.
  • All current 2D types can use panels, including contour and polarplot.
  • No tile spans, layout options, axes handles, hold or multiple simultaneous active figures.
  • plot3 and surf are rejected inside a tiled layout. Use clf() to leave the grid before standalone 3D plotting.
  • clf() clears the entire layout, not only the selected panel.
04

Studio and Canvas

Panels have independent axes, legends and zoom. Metadata-only updates preserve zoom; redraws or changed bounds reset the affected view. PNG export captures the full grid, not just the selected panel.

Canvas keeps one materialized figure snapshot across incremental panel updates, including updates emitted by later blocks. The saved document preserves these data; its HTML export still contains serialized figure data rather than rendered plot images.

Sun is proprietary software under experimental development. Documentation scope: Sun 0.6 development snapshot.