using imagesc to plot a matrix of data

1 回表示 (過去 30 日間)
C.G.
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 件のコメント
KSSV
KSSV 2021 年 10 月 7 日
Try with pcolor.
C.G.
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
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.
C.G. 2021 年 10 月 7 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by