matlab中bar函数中 grouped什么意思,求举例

2025-03-18 20:20:45
推荐回答(1个)
回答1:

bar(…,’grouped’) 使同一组直方条紧紧靠在一起;bar(…,’stack’) 把同一组数据描述在一个直方条上。

列子:

clear all;

clc;

y=[5 3 2 9;4 7 2 7;1 5 7 3];

x=[5 9 11];

subplot(2,2,1),bar(y);

subplot(2,2,2),bar3(x,y);

subplot(2,2,3),bar(x,y,'grouped');

subplot(2,2,4),bar(rand(2,3),.75,'stack');