how to use code for printing values on top of vertical bars with horizontal bars?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I want to try horizontal bars and print the values right of the bars.
My actual code which prints 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);
My problem is that unfortunately I don't understand this code, which means I cannot alter it correctly. I have this code from another question which I asked on this forum. When I use "hbar"for horizontal bars, the values which you can see on top of the bars disapper.
How the code has to be altered?
Thanks, David
댓글 수: 0
답변 (1개)
Image Analyst
2013년 2월 4일
They're the x and y values. In text, try adding an offset to the x values and reducing the y values by some factor, say half:
xvals+10,[DataFps1 DataFps2 DataFps3 DataFps4 DataFps5]* 0.5
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!