The pcolor and surf functions discard a row and column of data. Take a look at the example file (the light bulb icon) for a depiction of the effect.
Chad Greene (2021). Offsets and missing data via pcolor and surf (https://www.mathworks.com/matlabcentral/fileexchange/50706-offsets-and-missing-data-via-pcolor-and-surf), MATLAB Central File Exchange. Retrieved .
Oh, nevermind. Please disregard my comment, I see where you refer to the file. It could be nice to have it on the front page though too ;)
I like how you show the differences between the function very clearly.
One small comment: the 'rgb' function is not included here, but is called in the 'pcolor_offset' code.
Nice illustration. Good to see more people are noticing/getting annoyed at this. These default MATLAB tools are in my opinion not suitable for image data. The slice function also has this flaw.
See also ind2patch function which can avoid this. Additional documentation on this with HELP_ind2patch as part of GIBBON toolbox.
I would say it doesn't "discard" data. Rather that for patch graphics for these functions it interprets the data as defined on corners of pixels/voxels rather than on pixel/voxels centres as is meant for image data.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!