www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/PlotCategoricalPieWithLabelsExample.m
%% Plot Categorical Pie Chart with Labels % Plot a categorical pie chart without any offset slices and label the % slices. When |X| is of data type |categorical| you must specify the % input argument |explode|. To specify % labels without any offset slices, specify |explode| as an empty % cell array, and |labels| as the labels. % Copyright 2015 The MathWorks, Inc. X = categorical({'North','South','North','East','South','West'}); explode = {}; labels = {'E','N','S','W'}; pie(X,explode,labels) %% % Now, offset a slice and label all slices. X = categorical({'North','South','North','East','South','West'}); explode = {'West'}; labels = {'E','N','S','W'}; pie(X,explode,labels)