Skip to content
Permalink
a056a1c421
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
57 lines (51 sloc) 1.12 KB
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