MATLAB: Does the MATLAB 7.0.1 (R14SP1) help for the PCOLOR function state that “PCOLOR is really a SURF with its view set to directly above”

docdocumentationMATLAB

In MATLAB 7.0.1, the help for the PCOLOR function states the following:
PCOLOR is really a SURF with its view set to directly above.
Yet, the example below seems to show that this is not the case:
[X,Y]=ndgrid(1:8,1:10);
Z=nan*zeros(size(X));
for cnt=1:1:8,
Z(cnt,cnt:(cnt+2))=[1,1,1];
end;
% plot using pcolor and surf seen from above
figure;
subplot(3,1,1), pcolor(X,Y,Z);
subplot(3,1,3), surf(X,Y,Z); view(2)

Best Answer

The following line in the PCOLOR help is a bit ambiguous:
PCOLOR is really a SURF with its view set to directly above.
The following line from the PCOLOR documentation is more precise:
A pseudocolor plot is a flat surface plot viewed from above. pcolor(X,Y,C) is the same as viewing surf(X,Y,0*Z,C) using view([0 90]).
However, the above is not correct in the case when C contains NaNs (because NaN * 0 = NaN). When this is taken into account, the above should read:
A pseudocolor plot is a flat surface plot viewed from above. pcolor(X,Y,C) is the same as viewing surf(X,Y,zeros(size(X)),C) using view([0 90]).