
Increase text size in Matlab graph
9 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Star Strider
2016 年 9 月 19 日
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')

その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!