Code covered by the BSD License  

Highlights from
cbrewer : colorbrewer schemes for Matlab

5.0

5.0 | 12 ratings Rate this file 165 Downloads (last 30 days) File Size: 252 KB File ID: #34087
image thumbnail

cbrewer : colorbrewer schemes for Matlab

by

 

This function loads colormaps based on the color brewer schemes (http://colorbrewer2.org/)

| Watch this File

File Information
Description

This function produces a colorbrewer table (rgb data) for a given type, name and number of colors of the colorbrewer tables. For more information on 'colorbrewer', please visit: http://colorbrewer2.org/
 
 The tables were generated from an MS-Excel file provided on the website
 http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_updates.html

This function also allows to use a variable number of colors for each colortable by interpolating the RGB indices

Based on the original data, there is only a certain number of colors available for each color scheme. When 'ncol' is larger then the maximum number of colors originally given, an interpolation routine is called (interp1) to produce an "extended" colormap.
 
To see the various colormaps available according to their types and names, simply call: cbrewer()

This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).

Acknowledgements

This file inspired Steamgraph, Rgbmap Color Maps, Cubehelix Colormaps, Intuitive Rgb Color Values From Xkcd, Color Brewer: Attractive And Distinctive Colormaps, and Paruly.

Required Products MATLAB
MATLAB release MATLAB 7.9 (R2009b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (14)
11 Aug 2014 Genevieve  
05 Aug 2014 Stephen Cobeldick

Users wanting a more user-friendly version of the ColorBrewer colorschemes can try my submission, which is available here:
http://www.mathworks.com/matlabcentral/fileexchange/45208

Rather than simply providing the data, it actually provides a function that can be used like any other standard colormap function in MATLAB ("hsv","jet","cool","hot","gray","bone",...).

For simple usage it requires only the map length and scheme name to define a colormap. The user can also set a default colorscheme and it can then be called exactly like any other MATLAB colormap function (i.e. a drop-in replacement). For colormaps larger than those defined by the original ColorBrewer data, it interpolates -all- of the ColorBrewer defined nodes for that colorscheme (not just the ones from the largest pre-defined colormap) to closer match the original ColorBrewer colormaps. Keeping all of the data in just one M-file means no file-clutter either!

Importantly my submission does NOT include any of the ColorBrewer data: these must be downloaded separately as an excel spreadsheet and are merged into the main M-file using a helper function (it is easy, and instructions are included!). The Color Brewer data are copyright under an Apache license:
http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer_updates.html

31 Jul 2014 Raul  
05 Jun 2014 Lieven Verbeke

Excellent! Easy to use as well.

22 Apr 2014 John D'Errico

As much as I like the idea, the implementation and the help could use some repair. It is not terribly friendly. It took me some time to figure out how to call it. I had to edit the code just to figure out the options, and to see that it is case sensitive, etc.

But once you figure out how to run the code, it should be useful. If you don't use it terribly often though, you may find yourself going through those explorations every time you need it.

22 Apr 2014 G Yee

Wonderful colormaps! I've been looking for a 'qualitative' dark colormap to use for my colorblind boss.

Since I'm a newbie, it took me a while to figure out how to do 2-D plots with this. Here's my code:

% Generate color-blind friendly colormap
colors = colormap(cbrewer('qual', 'Dark2', N));

% Example plot
x = 1:5;
N = 12;

figure(1);clf;
for i = 1:N
y = x*i; % some big calculation
figure(1); hold on;
p = plot(x,y, 'Color' ,colors(i,:), 'LineWidth', 2);
end

19 Apr 2014 Raul  
02 Oct 2013 Kirsten  
17 Sep 2013 Johannes Keyser

Beautiful maps, highly useful, Thanks a lot!

Just the zip archive could use a little cleaning (it contains unnecessary hidden files: ._cbrewer.m ._interpolate_cbrewer.m ._plot_brewer_cmap.m).

16 Jun 2013 Danny

works perfectly. very easy to use and a great improvement over the Matlab defaults. Thank you!

13 Feb 2013 Antje  
13 Jun 2012 Richard

Since a colleague introduced me to Brewer colour schemes I've been looking for a way to use them in matlab without manually entering all the RGBs. Very useful.

20 Mar 2012 Jan Neggers  
24 Jan 2012 Andrew Bliss

Nice to see someone port these color scales to Matlab. Thanks!

[You don't need to include the hidden files or the preview jpg in the download].

Contact us