MATLAB: Is there plot data missing when using the SURFACE command with large X values

MATLAB

When running the line of code:
sn=1e8;
x=[sn:1:sn+99];
y=1:1:5;
z=randn(5,100);
figure
surface(x,y,z);
The number of x-axis pixels plotted is not the same as defined by the x-axis vector, which should be 100 in this case.

Best Answer

This behavior is due to the figure's rendering properties. The default renderer, OpenGL, does not do colormap interpolation.
When creating a surface or patch using indexed color and interpolated face or edge coloring, Open GL interpolates through the RGB color cube instead of through the colormap, and this causes some color data to get lost in the rendering process.
To work around this issue, change the figure's current rendering properties by entering:
set(gcf,'Renderer','Painters');