File Exchange

image thumbnail

Offsets and missing data via pcolor and surf

version 1.1.0.0 (177 KB) by Chad Greene
A brief explanation of the half-pixel offset in pcolor and surf.

1 Download

Updated 01 May 2015

View License

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.

Cite As

Chad Greene (2020). 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 .

Comments and Ratings (5)

Lucademicus

Danny

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 ;)

Danny

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.

Updates

1.1.0.0

Minor edits.

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux