Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
function [plotDataM] = plotHeatmap(dataM, filename, climmin, climmax)
% PLOTHEATMAP
% Plots the heatmap given a matrix
%
% INPUT PARAMS
% Param dataM
% The matrix to be plotted
%
% Param filename
% Filename for the PDF with the matrix plotted
%
% Param climmin, climmax
% Colormap limits -- minimum and maximum
%
% OUTPUT PARAMS
% Param plotDataM
%
% ADDITIONAL NOTES
% -- Standardize the values in the range [0,1]
% -- Plot the heatmap
%
% Author: snikumbh@mpi-inf.mpg.de
% instances along columns
% sequences along rows
shading interp;
if nargin < 4
climmin = 0.75;
climmax = 0.95;
elseif nargin < 2
filename = 'Heatmap.pdf';
end
%standardize matrix rows to range 0-to-1
normDataM = standardizeMatrix(dataM);
% plotDataM = normDataM;
plotDataM = zeros(size(normDataM));
% using rankings
[~, rankingDataM] = sort(normDataM(1:size(dataM,1),1:size(dataM,2)), 2, 'descend');
for i=1:size(plotDataM,1)
plotDataM(i,rankingDataM(i,:)) = 1:size(dataM,2);
end
%
fig = figure;
%
clims = [climmin climmax];
% clims = [0 1];
imagesc(plotDataM);
cb = colorbar;
%
% saveas(gcf, filename, 'pdf');
print(gcf, filename, '-dpdf', '-r900');
end