Clear Filters
Clear Filters

Colormap gradient on patch object together with a surface object

1 view (last 30 days)
I use surf and patch in the same plot but the colors on the patch's face changes when I add the surface. How do I get the entire colormap on the patch face?
patch('faces',[1 2 3 4],'vertices',[0 0 0; 0 100 0; 0 100 10^8; 0 0 10^8],...
'FaceColor','interp','FaceVertexCData',[0 0 10^8 10^8]')

Accepted Answer

Patrick Kalita
Patrick Kalita on 11 May 2012
When the surface is added, MATLAB automatically changes the figure's Renderer to OpenGL -- which has a bug in how it does color interpolation. Try manually setting the Renderer to zbuffer:
set(gcf, 'Renderer', 'zbuffer')

More Answers (0)


Find more on Colormaps in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!