This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Plot nodes and links representing adjacency matrix


[X,Y] = gplot(A,Coordinates)


The gplot function graphs a set of coordinates using an adjacency matrix.

gplot(A,Coordinates) plots a graph of the nodes defined in Coordinates according to the n-by-n adjacency matrix A, where n is the number of nodes. Coordinates is an n-by-2 matrix, where n is the number of nodes and each coordinate pair represents one node.

gplot(A,Coordinates,LineSpec) plots the nodes using the line type, marker symbol, and color specified by LineSpec.

[X,Y] = gplot(A,Coordinates) returns the NaN-punctuated vectors X and Y without generating a plot. Use X and Y to generate a plot at a later time using plot(X,Y). To use this syntax, Coordinates must be of type single or double.


collapse all

Plot half of a "Bucky ball" carbon molecule, placing asterisks at each node.

k = 1:30;
[B,XY] = bucky;
axis square

More About

collapse all


For two-dimensional data, Coordinates(i,:) = [x(i) y(i)] denotes node i, and Coordinates(j,:) = [x(j)y(j)] denotes node j. If node i and node j are connected, A(i,j) or A(j,i) is nonzero; otherwise, A(i,j) and A(j,i) are zero.

See Also

| |

Introduced before R2006a

Was this topic helpful?