From: Stefan Heinen on
Hey,

I like to name the bars of a barchart. Anyone a suggestion?

Thx,

Stefan
From: us on
"Stefan Heinen" <s.g.h.heinen(a)live.com> wrote in message <hu0eqd$lnv$1(a)fred.mathworks.com>...
> Hey,
>
> I like to name the bars of a barchart. Anyone a suggestion?
>
> Thx,
>
> Stefan

one of the (tedious) solutions

% the data
d=[
4 8 9 7 4
8 7 5 5 8
2 7 1 4 9
];
lab={
'ab' 'bc' 'ef' 'ww' 'qq'
'q' 'd' 'c' 'w' 'r'
'w' 'i' 'yr' 'w' 'r'
};
% the engine
bh=bar(d);
xd=get(bh,'children');
xd=get([xd{:}],'xdata');
xd=cat(2,xd{:});
xdd=diff(xd);
xd=sort(xd(1,:)+.5*xdd(2,1));
set(gca,'xtick',xd);
set(gca,'xticklabel',lab.');
yl=get(gca,'ylim');
set(gca,'ylim',[yl(1),yl(2)+3]);
text(xd,repmat(11,1,numel(xd)),lab.','horizontalalignment','center');

us