Colormap gradient on patch object together with a surface object

조회 수: 1 (최근 30일)
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?
Example:
[X,Y]=meshgrid(1:100,1:100);
Z=(X.*Y).^2;
surf(X,Y,Z)
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]')

채택된 답변

Patrick Kalita
Patrick Kalita 2012년 5월 11일
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')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by