如何在R中绘制关系? [英] How to plot relationships in R?

查看:113
本文介绍了如何在R中绘制关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这种关系表示为矩阵x,如下所示:

The relationship is expressed as a matrix x like this:

      John Jack Mary Wendy
John     0    2    1     1
Jack     2    0    1     0
Mary     1    1    0     1
Wendy    1    0    1     0

条目是指它们具有的连接数. 谁能告诉我如何在R中将其绘制为网络?谢谢!

The entries refer to the number of connections they have. Could anyone show me how to plot it as a network in R? Thanks!

推荐答案

这称为邻接矩阵.

R中的常见问题解答中有一些信息绘制表示为矩阵的社交网络:

There is some information in the R FAQ on plotting social networks expressed as matrices:

使用igraph可以轻松完成社交网络数据的绘制 为了使igraph程序包将此表识别为网络,我们首先可以将其转换为矩阵.然后,如果我们希望基于它来计算与图形相关的统计信息(介于中间,紧密度,度数之间),则可以使用矩阵来创建图形对象.

Plotting social network data can be easily done with the igraph package in R. [...] In order for the igraph package to recognize this table as a network, we can first convert it to a matrix. Then, if we wish to calculate graph-related statistics on it (betweenness, closeness, degree), we can use the matrix to create a graph object.

常见问题解答提供了一些示例,生成了社会图表,例如:

The FAQ gives some examples, resulting in sociogram diagrams, for example:

igraph库本身是此处记录的-它可以产生更复杂的示例-请参见屏幕截图页面和以下示例:

The igraph library itself is documented here - it can produce much more complex examples - see the screenshots page and the example below:

这篇关于如何在R中绘制关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆