How to Create Plot of Weights at Spatial Locations (Connectivity Map)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Corey Hoydic
am 30 Jun. 2021
Kommentiert: Kelly Kearney
am 2 Jul. 2021
I am wondering what tools in Matlab are available to create a plot of "connectivities" between different spatial locations. Basically, I have locations of data (I and P) as well as weights (f_IP) indicating the strength of the connection between each I and P, pointing from I to P. The plot I desire to create looks like the below:

Again, there are P weights pointing from each I toward each P. Larger weights are of larger size on the plot. Looking around, I have found Matlab functions that do similar things, but nothing quite like what I am looking for. Any guidance/recommendations would be appreciated.
0 Kommentare
Akzeptierte Antwort
Kelly Kearney
am 1 Jul. 2021
There aren't any pre-packaged functions to do this, but it should be pretty straightforward to create a function the calculates the vertices of each triangle shape given the coordinates of a P/I pair and the weight connecting them. You can then plot it as a multi-faceted patch. Example to come if I get some free time tomorrow...
2 Kommentare
Kelly Kearney
am 2 Jul. 2021
An example... adjust as needed:
% Coordinates of I and P points
Ixy = [...
0 20
20 20
10 10
0 0
20 0];
Pxy = [...
10 20
0 10
20 10
10 0];
% Weights connecting I (rows) to P (columns)
w = [...
2 2 1 1
2 1 2 1
2 2 2 2
1 2 1 2
1 1 2 2]*2;
% Calculate angles between each I/P pair
[xi, xp] = ndgrid(Ixy(:,1), Pxy(:,1));
[yi, yp] = ndgrid(Ixy(:,2), Pxy(:,2));
dx = xp - xi;
dy = yp - yi;
ang = atan2(dy,dx);
% Calculate coordinates of triangles
dang = pi/30;
xpatch = [xi(:) xi(:)+w(:).*cos(ang(:)+dang) xi(:)+w(:).*cos(ang(:)-dang)]';
ypatch = [yi(:) yi(:)+w(:).*sin(ang(:)+dang) yi(:)+w(:).*sin(ang(:)-dang)]';
% Plot
patch(xpatch, ypatch, 'g');
axis equal;
text(Ixy(:,1), Ixy(:,2), compose('I%d', 1:size(Ixy,1)), 'horiz', 'center');
text(Pxy(:,1), Pxy(:,2), compose('P%d', 1:size(Pxy,1)), 'horiz', 'center');
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Polar Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!