Imagesc defining only 3 colours for my entire data
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hi i have a matrix that is 500x600 within this i have data values ranging from 0.2 to -0.2
i have looked at user the figure colour map editor but i cannot get my desired results.
i am hoping to set out a plot with these distinctive properties for the values:
0.2>x> 0.07 - Red
0.07>x>0 - green
x = 0 - Blue
0>x>-0.07 - Green
-0.07>x>0.2 - Red
is there anyway to alter the plot to show the results in this manner?
thanks for any help Kyle
figure(i)
subplot(3,1,1);
imagesc(ux);
axis equal off
colorbar
0 commentaires
Réponses (1)
Image Analyst
le 18 Août 2013
Make a 256 row colormap. Then determine the index where the changes happen. For example 0 is at row 128, and 0.07 is at row 129 or whatever. Then make up the colormap and apply it
myColorMap(0:row1, :) = [1,0,0]; % Red
myColorMap(row1+1:127, :) = [0,1,0]; % Green
myColorMap(128,:) = [0, 0, 1]; % Blue
and so on.
2 commentaires
Image Analyst
le 19 Août 2013
That can be vectorized into 3 faster lines. But anyway, I don't see how that applies colors.
Voir également
Catégories
En savoir plus sur Red 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!