
Increase text size in Matlab graph
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi!
I am using Matlab graph function to plot an adjacency matrix. However, the node labels in the graph are very small. Could somebody please tell me a way to increase the text font size? (The usual font increasing options such as
set(gca,'fontsize',18)
does not work for the graph function) . Thanks.
0 commentaires
Réponse acceptée
Star Strider
le 19 Sep 2016
I’m not exactly certain what you want. I modified this example from the graph documentation to change the font size of the node labels:
s = [1 1 1 2 2 3 3 4 5 5 6 7]; % Begin Original Documentation Example
t = [2 4 8 3 7 4 6 5 6 8 7 8];
weights = [10 10 1 10 1 10 1 1 12 12 12 12];
names = {'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H'};
G = graph(s,t,weights,names);
figure(1)
h = plot(G,'EdgeLabel',G.Edges.Weight); % End Original Documentation Example
nl = h.NodeLabel;
h.NodeLabel = '';
xd = get(h, 'XData');
yd = get(h, 'YData');
text(xd, yd, nl, 'FontSize',18, 'FontWeight','bold', 'HorizontalAlignment','left', 'VerticalAlignment','middle')

2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!