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

    %% Modify Text Label for Pie Chart
% Create a labeled pie chart, and then modify the color and font size of the text labels.

% Copyright 2015 The MathWorks, Inc.


X = 1:3;
labels = {'Taxes','Expenses','Profit'};
p = pie(X,labels)
%% 
% Get the text object for the label 'Profit'. Change its color and font
% size. Starting in R2014b, you can use dot notation to set properties. If
% you are using an earlier release, use the <docid:matlab_ref.f67-432995>
% function instead.

t = p(6);
t.BackgroundColor = 'cyan';
t.EdgeColor = 'red';
t.FontSize = 14;