how to change the size of the fonts inside the bar graph

5 visualizaciones (últimos 30 días)
Tony Cheng
Tony Cheng el 13 de Mayo de 2025
Editada: Chuguang Pan el 13 de Mayo de 2025
Hi there,
I am using the bar code to draw a bar graph. So how to change the size of the fonts inside the graph, as shown in the attachment?
Many thanks!
Cheers

Respuesta aceptada

Chuguang Pan
Chuguang Pan el 13 de Mayo de 2025
Editada: Chuguang Pan el 13 de Mayo de 2025
use text function with FontSize option to change font size
x = [1 2 3];
vals = [2 3 6; 11 23 26];
b = bar(x,vals);
xtips1 = b(1).XEndPoints;
ytips1 = b(1).YEndPoints;
labels1 = string(b(1).YData);
text(xtips1,ytips1,labels1,'HorizontalAlignment','center',...
'VerticalAlignment','bottom','FontSize',15)

Más respuestas (0)

Categorías

Más información sobre Discrete Data Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by