How to reset the label range for a heatmap?

조회 수: 2 (최근 30일)
Tianming Qu
Tianming Qu 2023년 1월 9일
댓글: Tianming Qu 2023년 1월 9일
Hi all,
I am new to Matlab, could anyone help me on how to reset the label range of a heat map?
Following is my code and my result fig
T=readtable('water_density_map_cumulative_10172022/7500.dx.csv');
A = table2array(T);
A_interp = interp2(A,7);
colormap turbo
!imagesc(A_interp);
colorbar()
I2disp = A_interp;
I2disp(I2disp(:)<0.009) = nan;
pcolor(I2disp([1:end,end],[1:end,end])),shading flat,axis ij
The heatmap form is 4000*4000 and the fig label is just 0-4000 for both x and y, however I want it range from, 0-30, is there any way I can do this?
Thanks for any help!

채택된 답변

dpb
dpb 2023년 1월 9일
Sure. Use the alternate form for pcolor with the requested X, Y coordinates...
C=I2disp([1:end,end],[1:end,end]; % a temporary for convenience
[nR,nC]=size(C);
X=linspace(0,30,nC);
Y=linspace(0,30,nR);
pcolor(X,Y,C)
  댓글 수: 6
dpb
dpb 2023년 1월 9일
Glad to...moral is we can't fix what we can't see... :)
If the Answer provided the solution to the Q?, please Accept it if for no other reason to let others know it isn't still pending...
Tianming Qu
Tianming Qu 2023년 1월 9일
I just accepted it as the answer. Thanks for the help

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Color and Styling에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by