How can I get use property colormap from heatmap to color the data points of (x,y) based on the values from r?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Rookie Programmer
le 9 Avr 2025
Modifié(e) : Rookie Programmer
le 9 Avr 2025
How can I use colormap(hot) to color the data points of (x,y) based on the values from r?
x = 150:50:5000;
y = -x+2000/5;
a = 30;
b = 0;
r = a+(b-a)*rand(1.length(x));
allData = [x;y;r];
figure;
heatmap(x,y, 'colormap', hot)
xlim([min(x) max(x)])
ylim([min(y) max(y)])
0 commentaires
Réponse acceptée
Voss
le 9 Avr 2025
Modifié(e) : Voss
le 9 Avr 2025
x = 150:50:5000;
y = -x+2000/5;
a = 30;
b = 0;
% r = a+(b-a)*rand(1.length(x));
r = a+(b-a)*rand(1,length(x));
figure()
scatter(x,y,[],r,'.')
colormap('hot') % or 'jet', or wtf you want
colorbar() % optional (once requested; no longer requested)
axis('tight')
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Color and Styling dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
