How to set the bars wider apart?
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
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)
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 Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!