Custom axis scale and colorbar form imagesc

83 views (last 30 days)
Hi,
I have an image I'm displaying with imagesc. By default, Matlab gives you the x and y axis of the pixel number. So if I have a 500x400 image, the y and x scale will go frim 1 to 500 and 1 to 400.
Instead, I would like that those axis show me the position in mm. My 500x400 image represent a real image of 10mm x 8mm. I would like my axis to show me values ranging from 0 to 10mm and 0 to 8mm. Is it possible in Matlab?
Furthermore, is is possible to have a log scale colorbar? I display the log10(image) values instead of image values and it would be nice to have the colorbar showing the real values.
Thank you for the help.
RMT

Accepted Answer

Raphaël
Raphaël on 23 Nov 2018
imagesc(x,y,image)
where
-image is a 2D matrix cointaining the data
-x is a two value vector corresponding to the start and end of the scaling, x = [0 8]
-y is a two value vector corresponding to the start and end of the scaling, y = [0 10]

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!