"Nobody trips over mountains. It is the small pebble(鹅卵石) that causes you to stumble(蹒跚). Pass all the pebbles in your path and you will find you have crossed the mountain. "
1.二维简单饼状图
x = [20,40,40];
labels = {'部分1','部分2','部分3'}; %用大括号,每个x中元素对应的标签
pie(x,labels);
title('各个部分占比')
x = [20,40,40];
labels = {'部分1','部分2','部分3'}; %用大括号,每个x中元素对应的标签
pie(x);
title('各个部分占比')
x = [20,40,40];
labels = {'部分1','部分2','部分3'}; %用大括号,每个x中元素对应的标签
ex = [ 1, 0, 0 ];%非0的位置突出显示
pie(x, ex);
title('各个部分占比')
lgd = legend(labels);
2.三维饼状图
将pie改为pie3,即得到“三维”的饼图。
pie3(x, ex);
3.比较两个饼图
y2010 = [50 0 100 95];
y2011 = [65 22 97 120];
labels = {'Investments','Cash','Operations','Sales'};
t = tiledlayout(1,2,'TileSpacing','compact');
% Create pie charts
ax1 = nexttile;
pie(ax1,y2010)
title('2010')
ax2 = nexttile;
pie(ax2,y2011)
title('2011')
% Create legend
lgd = legend(labels);
lgd.Layout.Tile = 'east';
参考:
CSDN博客-MATLAB--pie函数绘制分类饼图(1)--附案例代码
标签:20,title,labels,pie,40,画饼,绘图,部分,白版 From: https://blog.csdn.net/febe1605/article/details/141283536