parula — Return the parula colormap as an m-by-3 RGB array.
parula returns MATLAB's default colormap as an m-by-3 numeric RGB array with values in [0, 1]. With no argument, it uses the current colormap length, or 256 when no figure colormap length is active.
Syntax
c = parula()
c = parula(m)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
m | NumericScalar | No | current colormap length or 256 | Number of colors as a nonnegative integer. |
Returns
| Name | Type | Description |
|---|---|---|
c | NumericArray | m-by-3 RGB colormap array with values in [0, 1]. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:colormapArray:InvalidArgument | The requested colormap length or RGB colormap array is invalid. | colormap array: invalid argument |
How parula works
parula()returns an m-by-3 RGB matrix.parula(m)returns exactlymrows, wheremmust be a nonnegative integer.- The result can be passed directly to
colormap, including command forms such ascolormap(parula).
Examples
Apply the default parula colormap
surf(peaks(40));
colormap(parula);
colorbar;Request a specific number of colors
c = parula(64);Using parula with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how parula changes the result.
Run a small parula example, explain the result, then change one input and compare the output.
FAQ
What size is parula()?⌄
It returns the active colormap length when one exists, otherwise 256 rows by 3 columns.
Related Plotting functions
2D Charts
area · bar · errorbar · heatmap · hist · histogram · loglog · pie · plot · scatter · semilogx · semilogy · stairs · stem
Other
addpoints · ancestor · animatedline · axes · barh · cla · clf · colorcube · colororder · copyobj · daspect · datacursormode · dataTipTextRow · fcontour · figure · fill3 · findobj · fsurf · gobjects · groot · hgload · hgsave · hidden · histogram2 · hold · line · linkaxes · openfig · opengl · pan · patch · plotmatrix · plotyy · polarhistogram · polarplot · polarscatter · print · quiver3 · ribbon · saveas · savefig · sphere · stackedplot · subtitle · suptitle · textscatter · textscatter3 · triplot · waitbar · wordcloud · xline · xscale · xtickangle · xtickformat · xticklabels · xticks · yline · yscale · ytickangle · ytickformat · yticklabels · yticks · zoom
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how parula is executed, line by line, in Rust.
- View the source for parula in Rust on GitHub
- Learn how the RunMat 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 blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.