Hi,
I have this script that will take data from 31 files, and make a colormap. I wanted to invert the y axis so that the 400 nm show up on the top (its of higher energy). How can I do that?
Thank you!
filenames={'000.mat','007.mat','013.mat','020.mat','027.mat','033.mat','040.mat','047.mat','053.mat','060.mat','067.mat','073.mat','080.mat','087.mat','093.mat','100.mat','107.mat','113.mat','120.mat','127.mat','133.mat','140.mat','147.mat','153.mat','160.mat','167.mat','173.mat','180.mat','187.mat','193.mat','200.mat'};
for i=1:numel(filenames)
load(filenames{i});
%print(filenames{i});
t_data(:,i) = lum.y0
end
angle = linspace(0,0.2,21);
wav_leng = lum.x0.';
figure;
imagesc(angle,wav_leng,t_data); colormap gray; axis xy;
xlabel('kx')
ylabel('Wavelegnth (nm)')
colorbar

 採用された回答

Voss
Voss 2022 年 4 月 26 日

1 投票

Do this:
set(gca(),'YDir','reverse')
at the end (or anywhere after imagesc).

4 件のコメント

Chalisa Mawla
Chalisa Mawla 2022 年 4 月 26 日
Thank you! It's exactly what I needed
Voss
Voss 2022 年 4 月 26 日
You're welcome!
Hasan Masud Khan
Hasan Masud Khan 2024 年 3 月 26 日
I get error when i used this function. why ????
DGM
DGM 2024 年 3 月 26 日
y is a numeric array, not an axes object. It has no 'dir' property. Axes objects don't have a 'dir' property either.
The first argument to set() should be an axes handle like Voss's example shows. The second argument should be a valid property name for the axes object ('ydir', not 'dir'). The set() command should be issued after the call to imagesc().
imagesc(x,y,z)
set(gca,'ydir','reverse') % or use 'normal' depending on ydata

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeColor and Styling についてさらに検索

製品

質問済み:

2022 年 4 月 26 日

コメント済み:

DGM
2024 年 3 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by