How to use specific vector to define axis in imagesc?

5 views (last 30 days)
Hello Guys~
I used imagesc(x,y,v), then I want to do a reciprocal conversion of the y-axis, y=1/y. But the y-axis did not show the correct value.
So,the main problem here is how to use a definite vector whose value are corresponding to the image axis and has the same size with the image rows.
here are my code and results,
x=1:n;y=linspace(0,fmax,m)';
y=1./y; y=y(2:end);
figure('color',[1 1 1]);
imagesc(x,y,v);
you can change the parameter as you wish.
the total rows of v is 600, but the y-axis lable seems linear interpolate between 172.5 and 0, how to correctly lable the y-axis?Thank you very much!

Accepted Answer

Image Analyst
Image Analyst on 24 Sep 2021
You can change the tick marks manually. See xticks() and xticklabels().

More Answers (1)

Walter Roberson
Walter Roberson on 24 Sep 2021
Only the first and last XData and YData are paid attention to. That used to be documented explicitly; last time I looked the documentation implied that only scalar or vector length 2 is permitted.

Community Treasure Hunt

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

Start Hunting!

Translated by