How to change axis of figure and shift matrix?

4 visualizaciones (últimos 30 días)
Mária Masárová
Mária Masárová el 21 de Abr. de 2021
Comentada: Mária Masárová el 21 de Abr. de 2021
I am trying to plot my matrix, which represents head mask (matrix 257x257) and skull mask (matrix 257x257). I need to adjust x and y axes, that ranges are from -128 to 128 and not from 1 to 257.
When I try to use xlim() and ylim() functions, axes are adjusted, but my matrix is still in a range from 1 to 257, which cause an only a quarter of the matrix is shown.
How can I plot the whole matrix but with adjusted axes od -128 do 128? It means, center of the head (and skull) will be at [0, 0].
figure;
imagesc(head_mask + skull_mask);
xlim([-128 128]);
ylim([-128 128]);

Respuesta aceptada

Adam Danz
Adam Danz el 21 de Abr. de 2021
Specify the x and y coordinates using the syntax imagesc(x,y,C)
x and y are merely 1x2 vectors of axis limits so it should be quite straightforward to implement.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by