Matlab画柱状图

首先楼主要推荐一个网站,介绍非常详细

https://plot.ly/matlab/bar-charts/

http://blog.qq.com/qzone/371890516/1381714805.htm (这个网站有实际的图,容易辨别你要的类型)

 

我这一次主要话stacked bar chart. 按照它的方法又要下载一些东西,我嫌麻烦,于是乎弄了一个简单版本的,实现我要的效果。

measles = [4 5]’;
mumps = [15 13]’;
chickenPox = [3 2]’;
figure
bar([measles mumps chickenPox], 0.5, ‘stack’)   这里0.5是改变柱状的粗细程度滴
axis([0 3 0 30])
set(gca, ‘XTicklabel’, {‘标题1’, ‘标题2’})
ylabel(‘Execution time’)
legend(‘阶段1’, ‘阶段3’, ‘阶段3‘)

之前画的图横坐标只是是数字,其实用了set(gca, ‘XTicklabel’, {‘Without Aggregation’, ‘With Aggregation’})就可以很简单实现这个功能,没必要去下载一堆东西啦!

 

            </div>

首先楼主要推荐一个网站,介绍非常详细

https://plot.ly/matlab/bar-charts/

http://blog.qq.com/qzone/371890516/1381714805.htm (这个网站有实际的图,容易辨别你要的类型)

 

我这一次主要话stacked bar chart. 按照它的方法又要下载一些东西,我嫌麻烦,于是乎弄了一个简单版本的,实现我要的效果。

measles = [4 5]’;
mumps = [15 13]’;
chickenPox = [3 2]’;
figure
bar([measles mumps chickenPox], 0.5, ‘stack’)   这里0.5是改变柱状的粗细程度滴
axis([0 3 0 30])
set(gca, ‘XTicklabel’, {‘标题1’, ‘标题2’})
ylabel(‘Execution time’)
legend(‘阶段1’, ‘阶段3’, ‘阶段3‘)

之前画的图横坐标只是是数字,其实用了set(gca, ‘XTicklabel’, {‘Without Aggregation’, ‘With Aggregation’})就可以很简单实现这个功能,没必要去下载一堆东西啦!

 

            </div>

猜你喜欢

转载自blog.csdn.net/yuan0061/article/details/80272284