# using imagesc to plot a matrix of data

조회 수: 11(최근 30일)
C.G. 2021년 10월 7일
댓글: C.G. 2021년 10월 7일
I am trying to see how temperature varies with different input parameters.
I have 2 input parameters which vary between 0.1-0.5 and 0.1-0.2. I have mean temperature for every combination of these parameters in a 5x2 double.
It generates the graph, but I only want the 0.1 interval labels and not the 0.05 intervals. I've tried to set limits on these but I dont want the position of the 0.1 interval labels to move, and I want to keep these in the centre of the box. Is there a way to do this? C = 0.1:0.1:0.2;
F = 0.1:0.1:0.5;
figure(1)
subplot(1,3,1)
imagesc(C,F,mean_GT)
set(gca, 'YDir','normal')
xlabel ('Restitution')
ylabel ('Friction')
colorbar
title ('ensemble mean GT')
xlim([0.5,0.2]);
set(gca,'XTick',[0.5:0.1:0.2]);
ylim([0.5,0.5]);
set(gca,'YTick',[0.5:0.1:0.5]);
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
C.G. 2021년 10월 7일
That doesn't help me as it still produces the same issue. My issue is that I want the axis numbers to be in the middle of each box.

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

### 채택된 답변

Chunru 2021년 10월 7일
%C = 0.1:0.1:0.2;
C = [0.1 0.2]; % There are only two points along x
F = 0.1:0.1:0.5;
figure(1)
subplot(1,3,1)
mean_GT = randn(5, 2);
imagesc(C,F,mean_GT)
set(gca, 'YDir','normal')
xlabel ('Restitution')
ylabel ('Friction')
colorbar
title ('ensemble mean GT')
%xlim([0.5,0.2]);
set(gca,'XTick',C);
%ylim([0.5,0.5]);
set(gca,'YTick',F); ##### 댓글 수: 1표시숨기기 없음
C.G. 2021년 10월 7일
Thank you!

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

### Community Treasure Hunt

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

Start Hunting!