How to make all of my heatmaps the same size?
Afficher commentaires plus anciens
Hello,
I have a script that creates multiple heatmaps in a for loop, all with different amounts of data. I want all of the heatmaps to be the same size (ex. 30 x 10) even though it might only have 1 data set and fill the rest of the map with NaN values.
I created an emptymap with the NaN values of the correct size, but I'm not sure how I can pass in that empty map, so that all of the maps I create have that same size.
This is what I have so far:
%Make an empty heat map of the correct value
data = NaN(30,10);
emptyMap = heatmap(data);
%Make heat maps for each table
for i = 1:length(Tables)
figure('Name','Heatmap','NumberTitle','off');
h = heatmap(Tables{i},'C','R','ColorVariable','Code');
h.ColorLimits = [0 100];
n = 100; % Number of color steps
red = linspace(1, 0, n)'; % Red decreases from 1 to 0
green = linspace(0, 1, n)'; % Green increases from 0 to 1
blue = zeros(n, 1); % Blue stays 0
custom_map = [red green blue];
colormap(custom_map);
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Distribution Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


