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 Center および File ExchangeData Distribution Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by