colormap — Set colormaps for images, surfaces, contours, and MATLAB colormap workflows.
colormap sets the active color palette for the current plotting context. In RunMat it affects colormap-driven visualizations such as imagesc, surf, surfc, contourf, and related scalar-field plots while remaining scoped to the active axes state.
How colormap works in RunMat
- Supported colormap names include
parula,viridis,plasma,inferno,magma,turbo,jet,hot,cool,spring,summer,autumn,winter,gray,bone,copper,pink, andlines. - Unknown colormap names raise errors rather than silently falling back.
- Colormap state composes naturally with
colorbar,imagesc,surf, and filled contour plots. - Colormap changes apply to the current axes context in the plotting state model.
Examples
Apply a palette to a scaled image
[X, Y] = meshgrid(linspace(-3, 3, 60), linspace(-3, 3, 60));
A = sin(X) .* cos(Y);
imagesc(A);
colormap('jet');
colorbar;Compare palettes across subplots
[X, Y] = meshgrid(linspace(-3, 3, 40), linspace(-3, 3, 40));
Z = sin(X) .* cos(Y);
subplot(1, 2, 1);
surf(X, Y, Z);
colormap('parula');
subplot(1, 2, 2);
contourf(X, Y, Z);
colormap('turbo');FAQ
What colormaps are available?
RunMat ships with: parula, viridis, plasma, inferno, magma, turbo, jet, hot, cool, spring, summer, autumn, winter, gray, bone, copper, pink, and lines. Unknown names raise an error — no silent fallback.
Which colormaps are perceptually uniform?
viridis, plasma, inferno, and magma are designed so that equal steps in data value produce equal perceptual changes in color. Use these for quantitative data where you want the visual contrast to faithfully represent magnitude differences. parula is also a good default. Avoid jet for quantitative work — it introduces false banding.
Can I define a custom colormap?
Not yet — colormap currently accepts named strings only. Custom N×3 RGB matrices are on the roadmap. For now, pick the closest built-in option or combine subplot-level colormaps to get variety across panels.
Related functions to explore
These functions work well alongside colormap. Each page has runnable examples you can try in the browser.
colorbar, imagesc, image, surf, contourf
More plotting resources
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how colormap works, line by line, in Rust.
- View colormap.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.