How to have Subplots of heatmaps in Matlab

조회 수: 29 (최근 30일)
Sachindra Dhanapala Arachchige
Sachindra Dhanapala Arachchige 2018년 4월 17일
Hi, I am trying to plot several heatmaps on the same figure as subplots. However I end up with individual figures. What the code produces is a figure named "HeatMap 1" and blank figure named "Figure 1". The figures do not have a coloubar as well, though i turned it on within the code. When I manually turn on the colorbar its limits are different from the limits that I specified in the code. Could someone kindly help me with this.
My code is as follows.
subplot(3,1,1);
HeatMap(Final_assessment_00001,'RowLabels', yvalues, 'ColumnLabels', xvalues, 'Colormap',autumn, 'Symmetric', false);
ax = H.plot; % 'ax' will be a handle to a standard MATLAB axes.
colorbar('Peer', ax); % Turn the colorbar on
caxis(ax, [-20 20]); % Adjust the color limits
subplot(3,1,2);
HeatMap(Final_assessment_00002,'RowLabels', yvalues, 'ColumnLabels', xvalues, 'Colormap',autumn, 'Symmetric', false);
ax = H.plot; % 'ax' will be a handle to a standard MATLAB axes.
colorbar('Peer', ax); % Turn the colorbar on
caxis(ax, [-20 20]); % Adjust the color limits
subplot(3,1,3);
HeatMap(Final_assessment_00003,'RowLabels', yvalues, 'ColumnLabels', xvalues, 'Colormap',autumn, 'Symmetric', false);
ax = H.plot; % 'ax' will be a handle to a standard MATLAB axes.
colorbar('Peer', ax); % Turn the colorbar on
caxis(ax, [-20 20]); % Adjust the color limits

답변 (1개)

Walter Roberson
Walter Roberson 2018년 4월 17일
This is not possible with the Bioinformatics HeatMap routine. HeatMap stores attaches several behaviors to the figure and those behaviors need to have a different result for each plot.
  댓글 수: 3
Walter Roberson
Walter Roberson 2018년 4월 17일
No, you switched from using the Bioinformatics HeatMap to using the newer and different heatmap. HeatMap vs heatmap. You had asked about HeatMap and for those it is not possible to put them in a subplot.
Sachindra Dhanapala Arachchige
Sachindra Dhanapala Arachchige 2018년 4월 17일
oh, yes. it seems you are correct. It's different heatmap, but does the job!. Thanks again!!!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by