How to have Subplots of heatmaps in Matlab

17 次查看(过去 30 天)
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
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