how to use code for printing values on top of vertical bars with horizontal bars?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Image Analyst
el 4 de Feb. de 2013
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
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!