matlab从关联矩阵绘制图形

标签 matlab graph plot gplots

有没有办法从关联矩阵绘制图表。 通过图表我的意思是http://en.wikipedia.org/wiki/Graph_(mathematics ) 不是情节。

到目前为止,我只找到了如何将关联矩阵转换为邻接矩阵。 在 R 中,这可以通过 igraph 库实现。那么有没有一种简单的方法可以在matlab中做到这一点

最佳答案

你可以使用gplot:

k = 1:30;
[B,XY] = bucky;
gplot(B(k,k),XY(k,:),'-*')
axis square

此函数常用于机器学习问题。在搜索时我看到了 implementation for weighted graph plotting .

enter image description here http://www.mathworks.com/help/matlab/ref/gplot.html

编辑:

dt = 2*pi/10;
t = dt:dt:2*pi;
x = cos(t); y = sin(t);
A = ones(10);
gplot(A,[x' y']);
A = ones(3,3);
gplot(A,[x' y']);
a = [0 1 1; 1 0 0; 1 1 0];
gplot(a,[x' y'] ,'-*');

您所要做的就是确保 XY 平面对于图中的每个节点都有足够的 (x,y) 对。

这是 A 的 gplot:

enter image description here

关于matlab从关联矩阵绘制图形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13309351/

相关文章:

MATLAB slider 回调

matlab - Matlab 级联目标检测器(使用 LBP)对于平面内旋转是否不变?

matlab - 将值附加到元胞数组中的多个元胞

algorithm - 查找删除断开图的所有节点对

algorithm - 带有额外点头的有向图上的旅行推销员

MATLAB : display 3 or more spectrograms side by side

performance - MATLAB 中的矢量化循环

python - 求解 Dijkstra 算法 - 通过两条边传递成本/双亲

r - R 中的绘图表,带有连接点的线

r - 如何使用像素矩阵将多个图像定位在同一个绘图上