Displaying node name in a network graph

조회 수: 2 (최근 30일)
Mariya B
Mariya B . 2016년 4월 14일
댓글: jd net . 2018년 9월 29일
Hello All,
I seem to have an issue in displaying the node names. My code goes as follows:
names = 1:295;
node_names=reshape(cellstr(num2str(names(:))),* size(names)); %%assigning node names
A = sprand( 295, 295, density );%%creating sparse random adjacency matrix
G =graph(A,node_names);
ax=axesm('mercator','MapLatLimit',[40 41],'MapLonLimit',[-74 -73]);
setm(gca, 'origin',[-74.900,-73.750,-73.5340])
Thanks in advance
  댓글 수: 1
jd net
jd net 2018년 9월 29일
is this possible to implement......for PEG algorithm

댓글을 달려면 로그인하십시오.

채택된 답변

Mike Garrity
Mike Garrity 2016년 4월 14일
I think that it doesn't label them by default when the number of nodes gets bigger than some number. You can tell it that you really do want them by using the labelnode function.
It does get a bit "busy" though.
  댓글 수: 3
Alok 2017년 6월 1일
you can try plot(G,'NodeLabelMode','auto') as well
jd net
jd net 2018년 9월 29일

댓글을 달려면 로그인하십시오.

추가 답변 (0개)


Help CenterFile Exchange에서 Networks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by