MATLAB heat map

user1739858 picture user1739858 · Oct 12, 2012 · Viewed 39.9k times · Source

I am trying to create a heat map using MATLAB, but the default function in MATLAB program doesn't any sense to me.

http://www.mathworks.com/help/bioinfo/ref/heatmap.html

Is there anyone who can help me with labeling first, so that I can read through the other function myself after that? Or is there any other program which will have a more user-friendly interface?

HeatMap(Data, ...'RowLabels', RowLabelsValue, ...)

I have a data set of a 81*2 matrix and my label is a 81*1 cell for x-axis and 1*2 for y-axis. Now I can successfully import the excel data and plot the data using a heat map, but I have a hard time fill in the variable in the HeatMap function.

Thanks so much.

Answer

Paweł Bulwan picture Paweł Bulwan · Jan 3, 2013

HeatMap isn't actually standard function for this, it comes from the Bioinformatics Toolbox. The simple way of drawing a heatmap might be like:

 A = 1:50;          % matrix to draw
 colormap('hot');   % set colormap
 imagesc(A);        % draw image and scale colormap to values range
 colorbar;          % show color scale

As @natan suggested, you might want to build your matrix first and then draw using image or imagesc. Also you migt want to see article on my blog which shows that some color sets are better for accessibility than others, e.g. for printing in grayscale or in color vision deficiency.