Colorbar from an array

7 vues (au cours des 30 derniers jours)
Diego Mauricio Beramendi Ortega
Réponse apportée : Voss le 28 Juin 2022
Hi all,
I am plotting geotiff files that have only one band. To do so I followed the next suggestions: https://uk.mathworks.com/matlabcentral/answers/517443-how-i-can-view-this-tif-file?s_tid=prof_contriblnk
I would like to know how to get a colobar according the array I used in the color map. Bellow I show my code:
[A,R1] = geotiffread('MOD06_L2.A2018001.1500.CER.WGS84.RAMIS.tif');
A = uint16(A);
brown_color = [0.5 0.2 0.1];
t = linspace(0, 1, max(A,[],'all'))';
cmap = t.*brown_color + (1-t);
gs = geoshow(A, cmap, R1);
Thanks in advance!!!!

Réponse acceptée

Voss
Voss le 28 Juin 2022
unzip data.zip
[A,R1] = geotiffread('MOD06_L2.A2018001.1500.CER.WGS84.RAMIS.tif');
A = uint16(A);
brown_color = [0.5 0.2 0.1];
t = linspace(0, 1, max(A,[],'all'))';
cmap = t.*brown_color + (1-t);
gs = geoshow(A, cmap, R1);
caxis([1 size(cmap,1)]);
colormap(cmap);
colorbar();

Plus de réponses (0)

Catégories

En savoir plus sur Orange 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!

Translated by