导入数据
clc,clear
opts = spreadsheetImportOptions("NumVariables", 2);
opts.Sheet = "Sheet2";
opts.DataRange = "A2:B7";
% opts.VariableNames = ["VarName1", "VarName2"];
opts.VariableTypes = ["string", "double"];
sj = readtable("退货的销量扇形图.xlsx", opts, "UseExcel", false);
clear opts
x =sj{:,2};
x=x';
y=sj{:,1};
y=y';
绘制图像
figure
pie(x)
加入脚标:
labels = y;
legend(labels,'Location','southoutside','Orientation','horizontal','NumColumns',3)
注释:
1.加入标注,3为一排有三个注释。
2.y为标准的名称。
把背景变为白色:
%角标每行有三个
set(gcf,'Color','white');
%背景为白色