How to set the bars wider apart?
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (2)
Youssef Khmou
on 4 Feb 2013
bar(data,width)
your data is the vector "data" you plot it with specified width , example :
bar(sin(0:0.01:10),0.2)
Matt Tearle
on 4 Feb 2013
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.
See Also
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!