Reputation: 27423
I have a block matrix that I visualize with pcolor
. I'd like to somehow visualize the block structure, so I'm looking for a mixture between shading flat
inside each block and shading faceted
at the borders, something like
a | b c | d e f
- + - - + - - -
g | h i | j k l
m | n o | p q r
(where each letter represents a color value and the lines separate the blocks) How can this be achieved?
Upvotes: 2
Views: 2156
Reputation: 12783
You could use imagesc
or imshow
(using axis xy
or axis ij
as required for orientation). Then simply set the xtick
and ytick
locations to those required by your lines, and call grid on
.
So for example
imagesc(im);
grid;
set(gca, 'xtick', [1.5, 2.5, 5.5],...
'ytick', [3.5, 4.5],...
'gridlinestyle', '-');
Note: to change image drawing such that you can work with integer gridline locations, you could instead call imagesc(0.5 : (size(im,1)-0.5), 0.5 : (size(im,2)-0.5), im)
as this offsets the pixel locations by -0.5.
Also while you can change the axis linewidth
property, I don't think you can get access to the grid line widths directly - for that level of control you might want to write a quick little function to add lines which would give you complete control over every line; or modify this this script which does just that!
Upvotes: 1