Plot graph with different markers
145 views (last 30 days)
Hello, I have a graph G lets say with 100 egdes and 40 nodes. The G.nodes are of 3 types stored in a vector type (40x1). How can I plot the graph so that each node adopt the mark corresponding to its type?
h = plot(G,'NodeLabel',mylabel);
mylabel is a 0x1 vector with the labelling of the nodes.
Any references would be really appreciatted.
dpb on 9 Feb 2020
See <Marker in Graphplot properties>. Pass an index array to the position of the desired marker type as the 'Marker' property.
mkrs=['o';'x','+']; % the desired markers lookup table
Gtype=[....]; % vector of 1,2,3 defining which marker for each element of G
Property 'NodeLabel' could be used to write some label instead of using the plot marker by the same lookup logic if your desired labels are something different than available plot markers.