在matlab中使用每个顶点的颜色绘制图形

在matlab中使用每个顶点的颜色绘制图形,matlab,graph,Matlab,Graph,我需要在给定三个参数的情况下绘制图表: 图邻接矩阵X(n*n) 每个顶点V的二维坐标矩阵(n*2) 包含使用rgb合成的每个顶点颜色的矩阵(n*3) 有什么工具我可以用来做这个吗?我想这就是你想要的 %// i took some random values as your input was not clear. %// you could replace it with your own values. V = [ 18 15 ; 14 19 ;

我需要在给定三个参数的情况下绘制图表:

图邻接矩阵X(n*n) 每个顶点V的二维坐标矩阵(n*2) 包含使用rgb合成的每个顶点颜色的矩阵(n*3)


有什么工具我可以用来做这个吗?

我想这就是你想要的

%// i took some random values as your input was not clear. 
%// you could replace it with your own values.

V = [ 18    15 ;  
      14    19 ;
       8    19 ;
       3    17 ;
       0    12 ;
       0     4 ;
       2     4 ; 
       8     5 ;
      14     9 ;
       4    20 ; 
      20    10]; 

C = rand(11,3);  %// replace it with your original color matrix
k = 1:11;
hold on
scatter(V(:,1), V(:,2), [],C,'filled');
gplot(X(k,k),V(k,:),'-');
text(V(:,1), V(:,2),[repmat('  ',11,1), num2str((1:11)')]);
hold off
输出:


您能举一个简单的矩阵示例吗?您可以尝试使用scatter3(),我不相信scatter3()是用来绘制图形的,边不会被表示。请给出您的
X
V
matrixX=[01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 00 01 01 01 01 00 01 01 01 01 00 01 01 01 01 01 01 01 01 0 01 01 01 01 0 01 01 01 0 01 01 0 01 01 0 0 01 01 01 0 0 0 0 01 01 01 0 0 0 0 0 0 0 01 01 0 0 0 0 0 0 0 0 0 0 01 01 01 0]试试这个:gplot(X,V)。但是,这不允许您为每个位置选择唯一的颜色。这非常有帮助。谢谢!