Black Lives Matter. Please consider donating to Black Girls Code today.

Network Graphs in MATLAB®

How to visualize a network with the adjacency matrix in MATLAB®. An example of MATLAB's gplot function.

% Learn about API authentication here:
% Find your api_key here:

% Create the onnectivity graph of the Buckminster Fuller geodesic dome
[B, V] = bucky;
H = sparse(60, 60);
k = 31:60;
H(k, k) = B(k, k);

% Visualize the graph using the gplot function (blue)
fig = figure;
gplot(B - H, V, 'b-');
hold on;

% Visualize a rotation of the graph (red)
gplot(H, V, 'r-');
axis off equal;


% Strip MATLAB<sup>&reg;</sup> style by default!
response = fig2plotly(fig, 'filename', 'matlab-graph-plot');
plotly_url = response.url;

MATLAB is a registered trademark of The MathWorks, Inc.