RunMat
GitHub

view — Control 3-D camera angles for surfaces and spatial plots using azimuth/elevation views and MATLAB view semantics.

view reads or updates the camera orientation for the current axes or an explicit axes handle. In RunMat it stores subplot-local azimuth and elevation state, supports MATLAB view(2), view(3), view([az el]), and view(az, el) call forms, and integrates with the same handle/property system used by get and set.

How view works in RunMat

  • view with no angle arguments queries the current [az el] pair.
  • view(2) selects the standard top-down 2-D camera and view(3) restores the standard 3-D camera preset.
  • Explicit azimuth/elevation values can be passed as two scalars or as a two-element vector.
  • View state is subplot-local and does not leak across different axes in a subplot grid.
  • Axes handles can be passed explicitly so camera changes target a specific subplot rather than whichever axes happens to be current.

Examples

Set an explicit 3-D camera angle

[X, Y] = meshgrid(linspace(-2, 2, 60), linspace(-2, 2, 60));
Z = sin(X.^2 + Y.^2);
surf(X, Y, Z);
view(45, 30);

Use MATLAB-style view presets

[X, Y] = meshgrid(linspace(-3, 3, 40), linspace(-3, 3, 40));
Z = sin(X) .* cos(Y);
surf(X, Y, Z);
view(2);
view(3);

Query a subplot-local camera

ax = subplot(1, 2, 2);
plot3(cos(0:0.1:5), sin(0:0.1:5), 0:0.1:5);
view(ax, [60 20]);
get(ax, 'View')

Expected output:

% Returns a 1x2 vector [60 20]

These functions work well alongside view. Each page has runnable examples you can try in the browser.

plot3, scatter3, surf, zlabel, get, set

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how view works, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.

  • Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
  • Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
  • A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.

Getting started · Benchmarks · Pricing

Try RunMat — free, no sign-up

Start running MATLAB code immediately in your browser.