三维柱状图(`bar3`)
三维柱状图(bar3)
02_柱与散点 5 张 MATLAB R2023b 100 mm 宽 @ 300 dpi
这个方法适合什么
两个分类维度加一个数值维度,用三维柱表达。适合:月×时段负荷、节点×谐波次数、年份×电压等级的统计数据。
电气场景
1 月时段最大负荷三维柱

2 节点谐波电流三维柱

3 年份电压等级售电量三维柱

4 变电站负荷类型三维柱

5 行业季度用电量三维柱

代码
脚本 p2_bar_scatter.m 中对应 bar3 的一段,SEL 用于选择只跑某几个方法。
if any(SEL==3)
% ---- 3.1 月 × 时段 最大负荷 ----
mr = {'1 月','3 月','5 月','7 月','9 月','11 月'};
tr = {'尖峰','高峰','平段','低谷'};
Y = [12.4 9.8 7.2 5.1
11.2 9.1 6.8 4.6
13.8 10.6 7.9 5.4
21.6 16.4 12.2 8.6
14.2 11.1 8.3 5.8
15.6 12.2 9.1 6.4];
f = ml_fig(PP,100,80);
ax = axes('Parent',f,'Position',[0.150 0.240 0.795 0.700]);
hb = bar3(ax,Y,0.62);
for k = 1:4, set(hb(k),'FaceColor',C(k,:),'EdgeColor',[0.25 0.25 0.25],'LineWidth',0.2); end
set(ax,'XTick',1:6,'XTickLabel',ml_tx(mr),'XTickLabelRotation',0,'YTick',1:4,'YTickLabel',ml_tx(tr));
xlabel(ml_tx('月份'));
ylabel(ml_tx('负荷时段'));
zlabel(ml_tx('有功负荷 <i>P</i> / MW'));
xlim(ax,[0.4 6.6]); ylim(ax,[0.4 4.6]); zlim(ax,[0 42]);
view(ax,-37.5,25); grid(ax,'on'); set(ax,'PlotBoxAspectRatio',[1.45 1 0.90]);
lg = legend(ax,hb,ml_tx(tr),'Location','northeast');
ml_style_legend(lg,PP);
save_png(f,FIGD,'月时段最大负荷三维柱');
% ---- 3.2 节点 × 谐波电流幅值 ----
hr = {'3 次','5 次','7 次','9 次','11 次','13 次'};
nr = {'节点 1','节点 2','节点 3','节点 4','节点 5'};
Y = [26.4 18.2 12.6 8.4 4.6
41.8 26.4 15.2 9.8 5.2
18.6 11.4 7.2 4.8 2.6
7.4 4.6 3.1 1.9 1.1
4.2 2.8 1.8 1.1 0.7
2.6 1.7 1.1 0.7 0.4];
f = ml_fig(PP,100,80);
ax = axes('Parent',f,'Position',[0.150 0.240 0.795 0.700]);
hb = bar3(ax,Y,0.62);
for k = 1:5, set(hb(k),'FaceColor',C(k,:),'EdgeColor',[0.25 0.25 0.25],'LineWidth',0.2); end
set(ax,'XTick',1:6,'XTickLabel',ml_tx(hr),'XTickLabelRotation',0,'YTick',1:5,'YTickLabel',ml_tx(nr));
xlabel(ml_tx('谐波次数 <i>h</i>'));
ylabel(ml_tx('母线节点'));
zlabel(ml_tx('谐波电流 <i>I</i>_{h} / A'));
xlim(ax,[0.4 6.6]); ylim(ax,[0.4 5.6]); zlim(ax,[0 82]);
view(ax,-37.5,25); grid(ax,'on'); set(ax,'PlotBoxAspectRatio',[1.45 1 0.90]);
lg = legend(ax,hb,ml_tx(nr),'Location','northeast');
ml_style_legend(lg,PP);
save_png(f,FIGD,'节点谐波电流三维柱');
% ---- 3.3 年份 × 电压等级 售电量 ----
yr = {'2022 年','2023 年','2024 年'};
vr = {'10 kV','35 kV','110 kV'};
Y = [12.4 6.8 3.2
13.6 7.4 3.6
14.8 8.1 4.0];
f = ml_fig(PP,100,80);
ax = axes('Parent',f,'Position',[0.150 0.240 0.795 0.700]);
hb = bar3(ax,Y,0.62);
for k = 1:3, set(hb(k),'FaceColor',C(k,:),'EdgeColor',[0.25 0.25 0.25],'LineWidth',0.2); end
set(ax,'XTick',1:3,'XTickLabel',ml_tx(yr),'XTickLabelRotation',0, ...
'YTick',1:3,'YTickLabel',ml_tx(vr));
xlabel(ml_tx('年份'));
ylabel(ml_tx('电压等级'));
zlabel(ml_tx('售电量 / 10^{8} kW·h'));
xlim(ax,[0.4 3.6]); ylim(ax,[0.4 3.6]); zlim(ax,[0 25]);
view(ax,-37.5,26); grid(ax,'on'); set(ax,'PlotBoxAspectRatio',[1.30 1 0.90]);
lg = legend(ax,hb,ml_tx(vr),'Location','northeast');
ml_style_legend(lg,PP);
save_png(f,FIGD,'年份电压等级售电量三维柱');
% ---- 3.4 变电站 × 负荷类型 ----
sr = {'城东站','城西站','工业站','新区站'};
kr = {'居民','商业','工业'};
Y = [18.4 12.6 9.2
22.6 15.8 11.4
6.2 8.4 34.8
14.2 6.8 5.4];
f = ml_fig(PP,100,80);
ax = axes('Parent',f,'Position',[0.150 0.240 0.795 0.700]);
hb = bar3(ax,Y,0.62);
for k = 1:3, set(hb(k),'FaceColor',C(k,:),'EdgeColor',[0.25 0.25 0.25],'LineWidth',0.2); end
set(ax,'XTick',1:4,'XTickLabel',ml_tx(sr),'XTickLabelRotation',0,'YTick',1:3,'YTickLabel',ml_tx(kr));
xlabel(ml_tx('变电站'));
ylabel(ml_tx('负荷类型'));
zlabel(ml_tx('负荷 / MW'));
xlim(ax,[0.4 4.6]); ylim(ax,[0.4 3.6]); zlim(ax,[0 68]);
view(ax,-37.5,25); grid(ax,'on'); set(ax,'PlotBoxAspectRatio',[1.45 1 0.90]);
lg = legend(ax,hb,ml_tx(kr),'Location','northeast');
ml_style_legend(lg,PP);
save_png(f,FIGD,'变电站负荷类型三维柱');
% ---- 3.5 行业 × 季度 用电量 ----
ir = {'冶金','化工','建材','纺织','数据中心'};
qr = {'一季度','二季度','三季度','四季度'};
Y = [42.6 46.2 51.8 45.4
31.2 34.8 38.6 33.4
18.4 21.6 24.2 19.8
12.6 14.2 15.8 13.4
8.4 10.2 12.6 11.8];
f = ml_fig(PP,100,80);
ax = axes('Parent',f,'Position',[0.150 0.240 0.795 0.700]);
hb = bar3(ax,Y,0.62);
for k = 1:4, set(hb(k),'FaceColor',C(k,:),'EdgeColor',[0.25 0.25 0.25],'LineWidth',0.2); end
set(ax,'XTick',1:5,'XTickLabel',ml_tx(ir),'XTickLabelRotation',0,'YTick',1:4,'YTickLabel',ml_tx(qr));
xlabel(ml_tx('用电行业'));
ylabel(ml_tx('季度'));
zlabel(ml_tx('用电量 / 10^{7} kW·h'));
xlim(ax,[0.4 5.6]); ylim(ax,[0.4 4.6]); zlim(ax,[0 100]);
view(ax,-37.5,25); grid(ax,'on'); set(ax,'PlotBoxAspectRatio',[1.45 1 0.90]);
lg = legend(ax,hb,ml_tx(qr),'Location','northeast');
ml_style_legend(lg,PP);
save_png(f,FIGD,'行业季度用电量三维柱');
end

浙公网安备 33010602011771号