How to have Subplots of heatmaps in Matlab

17 vues (au cours des 30 derniers jours)
Sachindra Dhanapala Arachchige
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

Réponses (1)

Walter Roberson
Walter Roberson le 17 Avr 2018
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 commentaires
Walter Roberson
Walter Roberson le 17 Avr 2018
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!!!!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by