필터 지우기
필터 지우기

Why is the line over imagesc not where I expected it to be?

조회 수: 3 (최근 30일)
Larissa Perez
Larissa Perez 2023년 3월 31일
답변: Star Strider 2023년 3월 31일
Hi,
I'm trying to make a plot over an imagesc plot. Currently, it looks like this:
However, the red lines should be around the peak frequencies (close to 0.12 Hz).
The code is:
hold on
hc=tplot(Tx, t, fs, opt);
plot(t,UpperCs(:,1), 'LineWidth', 2, 'Color','k');
plot(t,LowerCs(:,1), 'LineWidth', 2,'Color','r');
hold off
where tplot is a function that created the imagesc. UpperCs and LowerCs are vectors of the same length as t and with values around 0.12, as I expected. So I don't understand why the lines are being plotted near 1.
Many thanks!

답변 (1개)

Star Strider
Star Strider 2023년 3월 31일
The image functions such as imagesc reverse the y-axis direction.
Experiment with:
set(gca, 'YDir','normal')
to see if that will do what you want.
If it also reverses the image, then experiment with the flipud function on the matrix being plotted to see if that puts everhything the way you want it.

카테고리

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

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by