MATLAB: Is RGB color data supported using the ‘painters’ renderer in a GUI

andcolordataguiMATLABpainterpatchrendererrgb

I executed the PATCH and XLIM commands in a GUI.
Executing only the patch did not show any warnings, but the warning message was thrown when using PATCH and XLIM.
For example open GUIDE and select "GUI with Axes and Menu".
In the file, comment the code from 88(popup_sel~) line to 100(end) line and add the commands below to the pushbutton1_Callback.
x = [0 0;0 1;1 1];
y = [1 1;2 2;2 1];
z = [1 1;1 1;1 1];
tcolor(1,1,1:3) = [1 1 1];
tcolor(1,2,1:3) = [.7 .7 .7];
patch(x,y,z,tcolor)
xlim([0 3]); ylim([0 3]);
There is a warning message in the command window after running the GUI:
Warning: RGB color data not yet supported in Painter's mode.

Best Answer

This warning message can be avoided by changing the renderer to 'zbuffer'. By default, MATLAB uses 'painters' as a default renderer. To change the renderer, use the SET command, as the following example illustrates
x = [0 0;0 1;1 1];
y = [1 1;2 2;2 1];
z = [1 1;1 1;1 1];
tcolor(1,1,1:3) = [1 1 1];
tcolor(1,2,1:3) = [.7 .7 .7];
patch(x,y,z,tcolor)
set(gcf,'Renderer','zbuffer')
xlim([0 3]); ylim([0 3]);