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?
You could use
imagescorimshow(usingaxis xyoraxis ijas required for orientation). Then simply set thextickandyticklocations to those required by your lines, and callgrid on.So for example
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
linewidthproperty, 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!