Runtime

2D and 3D graphics

Hosted plotting in Sun Studio with validated numeric inputs.

01

2D curves

Sun
x = 0:0.1:6;
plot(x, sin(x));
title("Sine");
xlabel("Time (s)");
ylabel("Amplitude");
grid(true);
02

2D plot types

Available commands include plot, area, bar, barh, histogram, semilogx, semilogy, loglog, stem, polarplot and contour. Most use (x, y); polarplot uses (theta, rho) with radians, histogram uses one values input, and contour uses one real matrix of at least 2-by-2.

Data must be real. Logarithmic axes require positive finite coordinates. A figure is limited to 16 curves and 10000 points; tiled layouts share these budgets across all panels. Nonfinite curve samples may create gaps rather than finite plotted points.

03

3D curves and surfaces

Sun
x = -2:0.2:2;
y = transpose(x);
Z = x .* x + y .* y;
surf(x, y, Z);
title("Paraboloid");
zlabel("Z");
04

Surface appearance and camera

view(2), view(3) or view(azimuth, elevation) changes a standalone 3D camera; elevation must lie between -90 and 90. Surface color maps are sun, parula, turbo, gray, hot and cool; shading accepts smooth, flat and faceted.

Sun
x = -2:0.2:2;
Z = x.^2 + (x.').^2;
surf(x, x, Z);
colormap("turbo");
shading("faceted");
view(45, 30);
05

Interaction and export

Studio supports figure expansion and PNG export. In a tiled figure, axes and zoom are independent per panel and PNG export includes the complete layout. Small containers scroll internally. Canvas stores figure data; its HTML export is not an embedded image export.

Use clf() to clear the whole active figure. Multiple simultaneous figures and hold are not implemented; tiled layouts support 2D panels only.

06

Host requirement

Support boundary

Graphics require a host with figure support, such as Sun Studio. The terminal host and LLVM backend reject plotting rather than silently dropping it.

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