www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/ExampleForPatchFunctionCInputExample.m

    %% Example for Patch Function C Input
% This example is embedded by section in the |C| input argument description
% on the patch function page.

% Copyright 2015 The MathWorks, Inc.



%% Single Color
x = [0 1 1];
y = [0 0 1];
c = 'r';
figure
patch(x,y,c)

%% Color Per Polygon - Colormap
x = [2 5; 2 5; 8 8];
y = [4 0; 8 2; 4 0];
c = [1 10];
figure
patch(x,y,c)
colorbar

%% Color Per Polygon - RGB
x = [2 5; 2 5; 8 8];
y = [4 0; 8 2; 4 0];
c = zeros(2,1,3);
c(:,:,2) = [.5 .8];
figure
patch(x,y,c)

%% Color Per Vertex
x = [2 5; 2 5; 8 8];
y = [4 0; 8 2; 4 0];
c = [6 4; 2 5; 3 10];
figure
patch(x,y,c)
colorbar