Imagesc - insert grid lines

4 visualizaciones (últimos 30 días)
susan
susan el 26 de Oct. de 2011
Hello,
m = 21 x 21 matrix
I want to draw grid lines onto the imagesc figure to signify certain groupings. And I don't want to do this manually since I have ~20 of these.
eg. black box around [1:3,1:3] to indicate that 1:3 is one group. red box around [5:10,5:10]

Respuesta aceptada

Wayne King
Wayne King el 26 de Oct. de 2011
imagesc(randn(21,21));
hold on;
h1 = rectangle('position',[1 1 3 3]);
set(h1,'EdgeColor',[0 0 0],'linewidth',3);
h2 = rectangle('position',[5 5 10 10]);
set(h2,'EdgeColor',[1 0 0],'linewidth',3);
  1 comentario
Image Analyst
Image Analyst el 27 de Oct. de 2011
Oh, is that what she wanted? Just simply displaying lines going from pixel center to pixel center? That's easy. I thought she wanted to go *around* the pixels, like right along the edges of the pixels, not through the centers, like Steve Eddins did on his recent blog entry.

Iniciar sesión para comentar.

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