本文介绍了Matlab:绘制栏组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想绘制条形图,其中条形图是这样分组的:
I want to plot bar plot in which bars are grouped like this:
我已经尝试了这段代码,但是没有得到这种类型的图.请指导我如何生成上述情节:
I have tried this code but I am not getting this type of plot. Please guide me how can I generate plot like above:
load Newy.txt;
load good.txt;
one = Newy(:,1);
orig = good(:,1);
hold on
bar(one,'m');
bar(orig,'g');
hold off
set(gca,'XTickLabel',{'0-19','20-39','40-79','80-159','160-319','320-639','640-1279','1280-1500'})
在每个文本文件中都有一个数字列表.该列表包含8个值.
In each text file there is a list of numbers. The list comprises of 8 values.
推荐答案
我有实现组栏的方法:
我必须对数据进行绘图,以便有8组条形,其中每组由3个条形组成.
I had to plot the data such that there are 8 groups of bars where each group consists of 3 bars.
为此,我将数据写在每个文件中,如下所示:
For that I wrote the data in my each file like this:
Y = [30.9858 1.36816 38.6943
0.655176 6.44236 13.1563
1.42942 3.0947 0.621403
22.6364 2.80378 17.1299
0.621871 5.37145 1.87824
0.876739 5.97647 3.80334
40.6585 68.6757 23.0408
2.13606 6.26739 1.67559
];
bar(Y)
这篇关于Matlab:绘制栏组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!