Effacer les filtres
Effacer les filtres

I need to place the results of several msheatmap functions one above the other in a single figure, where they share the x-axis

1 vue (au cours des 30 derniers jours)
Hello, I am analyzing several variables and I want to visually compare their behavior. For that I have used the msheatmap function that allows me to obtain a mapheat for each of the variables. Unfortunately I don't see a way to group all the results in a single figure that allows me to quickly see groupings of events. I tried to save the figures and then integrate them into a single one but it indicates that information components are lost. The desired result would be as the figure shown below. thanks

Réponses (1)

Shaik
Shaik le 15 Mai 2023
Hi,
To visually compare the behavior of multiple variables and create a single figure with grouped events, you can use the subplot function in MATLAB. This function allows you to create a grid of subplots within a single figure, where each subplot represents a different variable or map heatmap.
Here's an example of how you can use subplot to create a single figure with multiple map heatmaps:
% Define your variables and their corresponding map heatmaps
variable1_heatmap = msheatmap(variable1);
variable2_heatmap = msheatmap(variable2);
variable3_heatmap = msheatmap(variable3);
% ... and so on for other variables
% Create a new figure
figure;
% Define the layout of subplots in a 2x2 grid (adjust as per your requirements)
numRows = 2;
numCols = 2;
% Plot the first variable's heatmap in the first subplot
subplot(numRows, numCols, 1);
imagesc(variable1_heatmap);
title('Variable 1');
% Plot the second variable's heatmap in the second subplot
subplot(numRows, numCols, 2);
imagesc(variable2_heatmap);
title('Variable 2');
% Plot the third variable's heatmap in the third subplot
subplot(numRows, numCols, 3);
imagesc(variable3_heatmap);
title('Variable 3');
% ... and so on for other variables
% Adjust the spacing between subplots if needed
subplotSpacing = 0.05; % Modify this value as desired
set(gcf, 'Position', get(0, 'Screensize')); % Maximize the figure window
set(gcf, 'Units', 'Normalized');
ax = gca;
axPos = ax.Position;
axPos(1) = axPos(1) + subplotSpacing;
axPos(2) = axPos(2) + subplotSpacing;
axPos(3) = axPos(3) - 2 * subplotSpacing;
axPos(4) = axPos(4) - 2 * subplotSpacing;
ax.Position = axPos;
% Add a colorbar to the figure
colorbar;
% Adjust any other settings for the overall figure
% Save the figure if desired
saveas(gcf, 'grouped_heatmaps.png'); % Adjust the filename and format as needed

Catégories

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

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by