How to set the bars wider apart?

3 次查看(过去 30 天)
David
David 2013-2-3
Hello,
the following link shows a diagram which I want to alter. http://imageshack.us/photo/my-images/38/resbitfull.jpg/
As you can see I have on top of the bars some values which overlap. So I need to set the bars wider apart, but how can I do that? I searched, but could not find any good solution.
My code for printing the values on top of each bar is the following ....
% Find the x location of each bar
xvals = unique(cell2mat(get(findall(hb,'type','patch'),'xdata')));
xvals = mean(reshape(xvals,2,[]));
% Put the text there
text(xvals,[DataFps1 DataFps2 DataFps3 DataFps4 DataFps5], ...
{[DataFpsLabels1 DataFpsLabels2 DataFpsLabels3 DataFpsLabels4 DataFpsLabels5]},...
'Vert','bot','horiz','cen','FontName','Arial','Fontsize',8);
Thank you for helping! David

回答(2 个)

Youssef  Khmou
Youssef Khmou 2013-2-4
bar(data,width)
your data is the vector "data" you plot it with specified width , example :
bar(sin(0:0.01:10),0.2)
  1 个评论
David
David 2013-2-4
Hi, if I use width 0.2 I get this:
for 0.9 I get:
So my text overlaps. But this is the reason why I want to set the bars wider apart. Using width seems make bars thinner or thicker, not setting them wider apart.

请先登录,再进行评论。


Matt Tearle
Matt Tearle 2013-2-4
The numbers currently go pretty much right across the width of the figure, so there's not a whole lot of real estate you can gain. You could space out the bars in each group, but only by decreasing the spacing between the groups.
This can be done by hacking around in HG, I think.
But I suspect your best bet is simply to reduce the relative size of the text to the figure, either by reducing the font size or increasing the figure window size.

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by