Dear all,
is it feasible to put the labels of the barh plot below inside the bars - and also the respective value ?
Thanks

 Respuesta aceptada

Star Strider
Star Strider el 12 de Jun. de 2022
Try this —
v = 52 .^ 1./(4:-1:1);
barname = {'Small','Medium','Large','Extra Large'};
figure
hbh = barh(1:4,v, 'FaceAlpha',0.5);
xlim([0 60])
text(hbh.YEndPoints/2, hbh.XEndPoints, compose('%s = %.1f',[string(barname); v].'), 'Horiz','center', 'Vert','middle')
I changed the 'FaceAlpha' (transparency) value to make the labels easier to see.
.

2 comentarios

René Lampert
René Lampert el 18 de Jun. de 2022
Thanks
Star Strider
Star Strider el 18 de Jun. de 2022
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Labels and Annotations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 12 de Jun. de 2022

Comentada:

el 18 de Jun. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by