Create a right axis which correspond to the first axis.

조회 수: 1 (최근 30일)
Mac
Mac 2022년 5월 9일
댓글: Mac 2022년 5월 10일
Hello guys. Badly need help. I have a wavenumber-frequency plot. I would like to add a right axis, but in period (1/frequency). Please help with the command. Below is my sample plot. Thank you very much.
  댓글 수: 2
Mac
Mac 2022년 5월 9일
Thanks mate. This (link) shows plotting different data. Mine is the same data but I want the right axis to be in period (1/f). Thank you mate.

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

채택된 답변

Chunru
Chunru 2022년 5월 9일
편집: Chunru 2022년 5월 9일
freq = [1000:10:5000];
wn = [-1.5:0.01:1.5];
p = 1./freq;
h1= axes;
data = randn(length(freq), length(wn));
imagesc(wn, freq, data);
axis xy
% create another axes with same position
% h2 = axes('Position', h1.Position, 'Color', 'none', 'YLim', h1.YLim, 'XTick', [], ...
% 'YAxisLocation', 'right', 'YTickLabel', sprintf('%.2e\n', 1./h1.YTick), 'FontSize', 8);
rightytick = [2.5 3 4]*1e-4;
rightytick = flip(rightytick);
h2 = axes('Position', h1.Position, 'Color', 'none', 'YLim', h1.YLim, 'XTick', [], ...
'YAxisLocation', 'right', ...
'YTick', 1./rightytick, 'YTickLabel', sprintf('%.2e\n', rightytick), 'FontSize', 8);
  댓글 수: 3
Chunru
Chunru 2022년 5월 9일
See above.
Mac
Mac 2022년 5월 10일
Thank you very much.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by