# A New Colormap for MATLAB – Part 1 – Introduction 19

Posted by **Steve Eddins**,

I believe it was almost four years ago that we started kicking around the idea of changing the default colormap in MATLAB. Now, with the major update of the MATLAB graphics system in R2014b, the colormap change has finally happened. Today I'd like to introduce you to parula, the new default MATLAB colormap:

showColormap('parula','bar')

(Note: I will make `showColormap` and other functions used below available on MATLAB Central File Exchange soon.)

I'm going spend the next several weeks writing about this change. In particular, I plan to discuss why we made this change and how we settled on parula as the new default.

To get started, I want to show you some visualizations using jet, the previous colormap, and ask you some questions about them.

**Question 1:** In the chart below, as you move from left to right along the line shown in yellow, how does the data change? Does it trend higher? Or lower? Or does it trend higher in some places and lower in others?

fluidJet hold on plot([100 160],[100 135],'y','LineWidth',3) hold off colormap(gca,'jet')

**Question 2:** In the filled contour plot below, which regions are high and which regions are low?

filledContour15 colormap(gca,rgb2gray(jet))

The next questions relate to the three plots below (A, B, and C) showing different horizontal oscillations.

**Question 3:** Which horizontal oscillation (A, B, or C) has the highest amplitude?

**Question 4:** Which horizontal oscillation (A, B, or C) is closest to a pure sinusoid?

**Question 5:** In comparing plots A and C, which one starts high and goes low, and which one starts low and goes high?

subplot(2,2,1) horizontalOscillation1 title('A') subplot(2,2,2) horizontalOscillation2 title('B') subplot(2,2,3) horizontalOscillation3 title('C') colormap(jet)

Next time I'll answer the questions above as a way to launch into consideration of the strengths and weaknesses of jet, the previous default colormap. Then, over the next few weeks, I'll explore issues in using color for data visualization, colormap construction principles, use of the L*a*b* color space, and quantitative and qualitative comparisons of parula and jet. Toward the end, I'll even discuss how the unusual name for the new colormap came about. I've created a new blog category (colormap) to gather the posts together in a series.

If you want a preview of some of the issues I'll be discussing, take a look at the technical paper "Rainbow Color Map Critiques: An Overview and Annotated Bibliography." It was published on mathworks.com just last week.

Get the MATLAB code

Published with MATLAB® R2014b

**Category:**- Colormap

### Note

Comments are closed.

## 19 CommentsOldest to Newest

**1**of 19

**2**of 19

**3**of 19

**4**of 19

**5**of 19

**6**of 19

hFig = figure(); hAxes = axes('Parent',hFig); rgb = zeros(1080,1920,3,'uint8'); hImg = image(rgb,'Parent',hAxes); set(hAxes,'Visible','off'); times = zeros(1,3); tic for i = 1:255 tic rgb = rgb + 1; times(1) = times(1) + toc; tic set(hImg,'CData',rgb); times(2) = times(2) + toc; tic drawnow times(3) = times(3) + toc; end times % Frames per second tEnd = toc; fprintf('Frames per second: %.0f\n',255/sum(times));actually runs slower on R2014b compared to R2014a on my DELL T3610 with NVIDIA GTX980, unless you switch to drawnow expose, which is not what I want. At least setting CData is significantly faster but drawnow eats it all up again. I feel that JAVA is limiting MATLAB very much in the field of video, although I understand that MATLAB image rendering may just be fast enough for most users. No offens, Steve, but I am disappointed about HG2. Don't get me wrong, I am a 9to5 MATLAB user since 10years and it's the language I like to use. The GPU computing stuff that matured over the last years is very useful for image processing. In that context setting CData with gpuArrays would be highly appreciated, assuming that data is not making the roundtrip via the CPU. I am sure MATHWORKS thinks about that already. So +1 from me here. Oliver ps.: HG2 has basically broken font rendering using "text" on every platform, unless you turn off "FontSmoothing" (Although I am sure there are good technical reasons for that, it is unacceptable) pps.: No need to publish this - won't help anyone.

**7**of 19

**8**of 19

**9**of 19

**10**of 19

**11**of 19

**12**of 19

**13**of 19

**14**of 19

**15**of 19

**16**of 19

**17**of 19

**18**of 19

**19**of 19

## Recent Comments