MATLAB: Limit number of colormap points in a trisurf

colormaptrisurf

I am trying to tell a trisurf only to use t diffrent colors in order highlight passages. My code looks like this:<br>
tri=delaunay(x,y);
plot(x,y,'.');
size(tri);
ts=trisurf(tri,x,y,z,c);
lighting none
shading interp
map=colormap(jet(t));
unfortunatly I am only able to limit the number of colors used in the colorbar, but not the trisurf itself.I know that i can change the shading to flat, but I need a slight interpolation of the color inbetween the points, but the colors used inbetween should still be limited by colormap;

Best Answer

Check your renderer.
get(gcf,'Renderer')
If it's OpenGL, then you've probably hit a bug in how interpolated color works in the OpenGL renderer.
If the size of x & y is large, then the system will choose OpenGL by default, but you can override that like so:
set(gcf,'Renderer','zbuffer')