Code covered by the BSD License  

Highlights from
othercolor

4.6

4.6 | 6 ratings Rate this file 49 Downloads (last 30 days) File Size: 186 KB File ID: #30564
image thumbnail

othercolor

by

 

28 Feb 2011 (Updated )

Extra colormaps for plotting. Contains diverging, sequential, categorical, and perceptual maps.

| Watch this File

File Information
Description

This is an embarrassingly simple function to augment the currently available MATLAB colormaps. It works as a seamless replacement for the current maps like jet and hsv. So to use it you just call colormap(othercolor('colorname')). The function handles interpolating to any number of points (othercolor('colorname',numpoints)) and uses the current axis as the reference if numpoints is not specified.

The available maps are stored in the file colorData.mat and you can easily add your own maps. To get a list of available names just call othercolor() without any arguments.

The 400+ colormaps are from 3 sources:
Mathematica (indexed, physical, gradient, and named)
http://geography.uoregon.edu/datagraphics/color_scales.htm
http://www.colorbrewer2.org

Some of these maps are better suited for sets of bar or line plots (particularly the qualitative sets). In those cases the last number in the name is the number of indexed colors, so it would probably be fitting to set M to that number to avoid interpolation. Example:

>> figure
>> colorscheme = othercolor('Set16',6);
>> set(gcf,'DefaultAxesColorOrder',colorscheme);
>> plot(rand(6,20));
>> legend(num2str((1:6)'))

* I'm looking for ideas on how to best organize these maps now that there are 400+ of them. If you have suggestions please leave them in the comments or send me an email.

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (10)
15 Mar 2013 fan zhang

great, wonderful, find what I need

29 Nov 2012 Nicolas Beuchat  
14 Jul 2012 Antonio

Excellent collection of colormaps! If more 4 color blends (like matlab jet) are added, it would improve it further.

14 Jul 2012 Antonio  
21 Aug 2011 Matteo Niccoli

Hi Joshua, nice collection, thanks for the effort! - very handy!

In my mind the best criteria for organizing colorbars would be the TYPE OF DATA they are intended to be used with, see:
http://changingminds.org/explanations/research/measurement/types_data.htm
and TASK they are best suited for. There's a bunch of papers recommended in my submission at:
http://www.mathworks.com/matlabcentral/fileexchange/28982

05 Mar 2011 David Wilson  
03 Mar 2011 Malcolm Lidierth

Take a look also at GColor on the FEX, http://www.mathworks.com/matlabcentral/fileexchange/30314-gcolor
and
http://www.mathworks.com/matlabcentral/fileexchange/29702-generate-maximally-perceptually-distinct-colors

02 Mar 2011 Joshua Atkins

Thanks, Dave. I tried briefly to get the Mathematica color schemes into MATLAB - that was my initial inspiration, but had no luck. I'm planning to try again this weekend.

Oleg - I submitted an update with your helpful suggestion, so it should be up soon. I've also included the colorbrewer2.org data in the new update.

02 Mar 2011 David Wilson

Some interesting and useful color schemes are given in the Mathematica help documentation for colordata. It would be really neat to reproduce those in Matlab.

http://reference.wolfram.com/mathematica/guide/ColorSchemes.html

01 Mar 2011 Oleg Komarov

Good idea, has L1 line, help, example, author details but I would change the core to get rid of the eval calls

% load color data
data = load('colorData.mat',n);

if isempty(fieldnames(data))
c = [];
else
c = interp1(linspace(0,1,size(data.(n),1)),data.(n),linspace(0,1,m),'cubic');
end

In this case if an unknown map is called c is empty.

Another approach would be to hardcode the maps into a structure in a subfunction...no need for the mat file then.

Oleg

Updates
02 Mar 2011

Included Oleg's suggestion to get rid of eval() statements.
Added ability to index colors numerically.
Added 200+ new colormaps from colorbrewer2.org
Added image files with pictures of the colormaps.

02 Mar 2011

Added all the colormaps from Mathematica.
Note: the "physical" and "gradient" maps are Mathematica functions, so they were sampled at 64 linearly spaced rgb points from 0 to 1 to fit with the MATLAB default.

Contact us