Skip to content

Instantly share code, notes, and snippets.

@MrOrz
Created September 16, 2012 11:59
Show Gist options
  • Save MrOrz/3732137 to your computer and use it in GitHub Desktop.
Save MrOrz/3732137 to your computer and use it in GitHub Desktop.
function printheatmap(filename, arr, colorlimits)
%PRINTHEATMAP(filename, arr)
% filename: EPS filename
% arr: surface zdata
xdata1 = linspace(0, 15, 1793);
ydata1 = linspace(0, 7, 769);
zdata1 = interp2(arr, 7, 'cubic');
% Create figure
%figure1 = figure('Colormap',...
% [1 1 1;1 1 0.916666686534882;1 1 0.833333313465118;1 1 0.75;1 1 0.666666686534882;1 1 0.583333313465118;1 1 0.5;1 1 0.416666656732559;1 1 0.333333343267441;1 1 0.25;1 1 0.16666667163372;1 1 0.0833333358168602;1 1 0;1 0.952380955219269 0;1 0.904761910438538 0;1 0.857142865657806 0;1 0.809523820877075 0;1 0.761904776096344 0;1 0.714285731315613 0;1 0.666666686534882 0;1 0.61904764175415 0;1 0.571428596973419 0;1 0.523809552192688 0;1 0.476190477609634 0;1 0.428571432828903 0;1 0.380952388048172 0;1 0.333333343267441 0;1 0.28571429848671 0;1 0.238095238804817 0;1 0.190476194024086 0;1 0.142857149243355 0;1 0.095238097012043 0;1 0.0476190485060215 0;1 0 0;0.966666638851166 0 0;0.933333337306976 0 0;0.899999976158142 0 0;0.866666674613953 0 0;0.833333313465118 0 0;0.800000011920929 0 0;0.766666650772095 0 0;0.733333349227905 0 0;0.699999988079071 0 0;0.666666686534882 0 0;0.633333325386047 0 0;0.600000023841858 0 0;0.566666662693024 0 0;0.533333361148834 0 0;0.5 0 0;0.466666668653488 0 0;0.433333337306976 0 0;0.400000005960464 0 0;0.366666674613953 0 0;0.333333343267441 0 0;0.300000011920929 0 0;0.266666680574417 0 0;0.233333334326744 0 0;0.200000002980232 0 0;0.16666667163372 0 0;0.133333340287209 0 0;0.100000001490116 0 0;0.0666666701436043 0 0;0.0333333350718021 0 0;0 0 0], ...
% 'Position', [0 0 450 750]);
figure1 = figure('Color', [0.800000011920929 0.800000011920929 0.800000011920929],...
'Position', [0 0 450 750]);
% Create axes
axes1 = axes('Parent',figure1,'YTick',[0 1 2 3 4 5 6 7],'YGrid','on',...
'XTick',[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15],...
'XGrid','on',...
'Layer','top',...
'FontSize',16,...
'CLim', colorlimits);
% Uncomment the following line to preserve the Y-limits of the axes
ylim(axes1,[0 7]);
view(axes1,[90.5 90]);
hold(axes1,'all');
% Create surf
surf(xdata1,ydata1,zdata1,'Parent',axes1,'LineStyle','none',...
'FaceColor','interp');
% Create colorbar
colorbar('peer',axes1,'FontSize',16);
set(gca,'layer','top');
set(gcf,'PaperPositionMode','auto');
print(filename, '-depsc2');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment