Making complex(ish) bar graphs?

1 次查看(过去 30 天)
Croy Carlin
Croy Carlin 2011-9-20
Second question of the day, I have a single set of values on the y axis (in this case lengths from 10-20 "units), and then I have 4 different items I want on the x axis (preferably in different colors), and I want them to be grouped in pairs (for easy comparison). How would I go about doing this?

回答(1 个)

Grzegorz Knor
Grzegorz Knor 2011-9-20
Something like this:
y = rand(4,1)*10+10;
bar([1,2],y(1:2),'r')
hold on
bar([3.5,4.5],y(3:4),'g')
set(gca,'xtick',[1 2 3.5 4.5],'xticklabel',{'A','B','C','D'})
ylabel('length [a.u.]')
?
See also:

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by