colorbar — Show or hide colorbars for images, surfaces, contours, and MATLAB colorbar workflows.
colorbar toggles the visibility of the color scale associated with the current axes. In RunMat it is subplot-local and is most often used with imagesc, image, surf, contourf, and related colormap-driven visualizations.
How colorbar works in RunMat
colorbar onenables the colorbar for the current axes.colorbar offdisables the colorbar for the current axes.- Calling
colorbarwith no argument toggles the current colorbar state. - Colorbar visibility is subplot-local and does not automatically affect other axes.
Examples
Show a colorbar for a scaled image
[X, Y] = meshgrid(linspace(-3, 3, 60), linspace(-3, 3, 60));
A = sin(X) .* cos(Y);
imagesc(A);
colorbar on;Use colorbars independently across subplots
[X, Y] = meshgrid(linspace(-3, 3, 40), linspace(-3, 3, 40));
Z = sin(X) .* cos(Y);
subplot(1, 2, 1);
contourf(X, Y, Z);
colorbar on;
subplot(1, 2, 2);
surf(X, Y, Z);
colorbar off;Related functions to explore
These functions work well alongside colorbar. Each page has runnable examples you can try in the browser.
colormap, imagesc, surf, contourf
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how colorbar works, line by line, in Rust.
- View colorbar.rs on GitHub
- Learn how the runtime works
- Found a bug? Open an issue with a minimal reproduction.
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.