www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/DisplayImageOverSurfaceExample.m
%% Display Image Along Surface Plot % Use the |peaks| function to define |XD|, |YD|, and |ZD| as 25-by-25 matrices. % Copyright 2015 The MathWorks, Inc. [XD,YD,ZD] = peaks(25); %% % Load the |clown| data set to get the image data |X| and its associated colormap, % |map|. Flip |X| using the |flipud| function and define % the flipped image as the color data for the surface, |C|. load clown C = flipud(X); %% % Create a surface plot and display the image along the % surface. Since the surface data |ZD| and the color data |C| have different dimensions, you must set the % surface |FaceColor| to |'texturemap'|. figure surface(XD,YD,ZD,C,... 'FaceColor','texturemap',... 'EdgeColor','none',... 'CDataMapping','direct') colormap(map) view(-35,45) %% % The clown data is typically viewed with the |image| function, which % uses |'ij'| axis numbering. This example reverses the image data in the % vertical direction using |flipud|.