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
The MATLAB contourf command may by useful to you.
I'm not sure what you're actually trying to accomplish, but I think you might want to use colormap{}. If you're trying to create a classic "heatmap", then colormap is the function you want. Basically, if you've got x,y position, and a Z value that you want to represent as a color, this is the trick for you.
You can use the Plotly MATLAB API to make a heatmap. Try this:
r = plotly({struct('z',randn(50,50), 'type','heatmap')}) % => https://plot.ly/~matlab_example/18dos(['open ', r.url])
You can see the interactive version and installation here.
Disclosure, I am on the Plotly team.
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.