Colorbar from an array

조회 수: 6 (최근 30일)
Diego Mauricio Beramendi Ortega
Diego Mauricio Beramendi Ortega 2022년 6월 28일
답변: Voss 2022년 6월 28일
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!!!!

채택된 답변

Voss
Voss 2022년 6월 28일
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();

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Orange에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by