How to create color map?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ilkin Abdullayev
le 5 Juin 2020
Commenté : Adam Danz
le 12 Juin 2020
Hello everybody,
I plot a bargraph by using 2x500, and I need to create a colormap. However it is a bit strange colormap so I need code that, for example, all the values between 15-20 will be blue, all the values between 20-25 will be red and so on. I have never worked with bar colormap and especially with this kind of code. If someone can help I would be very glad.

Thanks in advance.
6 commentaires
Réponse acceptée
Adam Danz
le 8 Juin 2020
Modifié(e) : Adam Danz
le 10 Juin 2020
Use a stacked bar graph by entering an nxm matrix which will produce n bars each with m segments.
h = bar(rand(20,40), 'stacked'); % 20 bars, 40 segments each
Change the color of bars 15-20 to blue.
set(h(15:20), 'FaceColor', 'b')
2 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

