How to set the bars wider apart?

조회 수: 8 (최근 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.
  댓글 수: 1
David
David 2013년 2월 12일
I hate Matlab....

댓글을 달려면 로그인하십시오.

카테고리

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