Specializing color map for positive and negative asymmetric data
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, How I can specialize two colormap for positive and negative data? For example, colormap(gray) for [0 36] , and colormap(pink) for [-23.5 0].
As I am NOT using pcolor, I can not plot it twice on one figure with 'hold on'. I am using colormesh2d which is a function that plots elevations on a finite element mesh.
Any thoughts is appreciated.
0 commentaires
Réponse acceptée
Walter Roberson
le 18 Jan 2019
caxis([-23.5 36])
cmap = [pink(23.5*2); gray(36*2)];
colormap(cmap)
If I have worked out the boundaries correctly, this should give you the colormap you requested.
The logic here is that each 0.5 is allocated a colormap slot, so [-23.5 -23), [-23 -22.5), [-22.5 -22) and so on up to [-0.5 0), 47 entries in total that are allocated pink entries. [0, 0.5), [0.5, 1), [1, 1.5) and so on follow up to [35.5 36), 72 entries of gray map.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur White 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!