✊🏿 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: https://plotly.com/matlab/getting-started
% Find your api_key here: https://plotly.com/settings/api

% 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;