Permalink
Cannot retrieve contributors at this time
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?
comik/plotHeatmap.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
57 lines (51 sloc)
1.12 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |