What is the default MATLAB Color Order?

Good question! There is a default colour order for MATLAB. Take note that versions before R2014b, the default colour order for MATLAB uses the jet colour map. In the jet colour map, the first plot is blue, followed by the second plot being green. For versions after R2014b, this follows the parula colour map, where the first plot would be a lighter blue followed by the second plot being a copper orange of sorts. If you actually want to know what the colour order is for your plot, make sure the plot is open in MATLAB, then do the following:

get(gca,'colororder')

This will return a 2D matrix where each row gives you the proportion of red, green and blue for each plot that you produce. On my machine at the time of this post when I was running MATLAB R2013a and with Mac OSX 10.9.5, this is what I got:

>> get(gca,'colororder')

ans =

         0         0    1.0000
         0    0.5000         0
    1.0000         0         0
         0    0.7500    0.7500
    0.7500         0    0.7500
    0.7500    0.7500         0
    0.2500    0.2500    0.2500

Each row gives you the red, green and blue values for a particular colour. The first row denotes the first colour to go on the plot, followed by the second row denoting the second colour and so on.

As such, the above colour order is:

  1. Pure blue
  2. A lighter shade of green
  3. Pure red
  4. A mixture of green and blue, which is cyan
  5. A mixture of red and blue, which is magenta
  6. A mixture of red and green which is yellow
  7. A light mixture of red, green and blue, which looks like a dark gray.

Currently (March 10th, 2016), I am using MATLAB R2015a and this is the colour map I get:

>> get(gca,'colororder')

ans =

         0    0.4470    0.7410
    0.8500    0.3250    0.0980
    0.9290    0.6940    0.1250
    0.4940    0.1840    0.5560
    0.4660    0.6740    0.1880
    0.3010    0.7450    0.9330
    0.6350    0.0780    0.1840

The RGB tuples in this case are slightly more complex and so it’s hard to infer what they are by just looking at the colours.


As an additional bonus, we can create an image that visualizes these colours for you. Assuming you have the image processing toolbox, this is the code I wrote to visualize those colours for each plot you place in your figure.

colours = permute(get(gca, 'colororder'), [1 3 2]);
colours_resize = imresize(colours, 50.0, 'nearest');
imshow(colours_resize);

Here’s what I got for MATLAB R2013a:

Running this code again in MATLAB R2015a, this is what I get:


Alternatively, you can always use a legend that delineates what histogram comes from which data.

Leave a Comment