使用 R 或 Excel 重叠图表
我有以下矩阵,我想使用 R (首选)或 Excel 绘制重叠图。
a b c
a 1 0.5 0.7
b 0.5 1 0.4
c 0.7 0.4 1
例如,上表显示 a
和 b
重叠率为 50%,而 a
和 c
重叠率为 70% %。
I have following matrix and I want to draw overlapping graph using R (preferable) or Excel.
a b c
a 1 0.5 0.7
b 0.5 1 0.4
c 0.7 0.4 1
For example, the above table shows that a
and b
have 50% overlapping, whereas a
and c
have 70%.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要重叠,那么您错过了一个数字 - 重叠所有三个:
a
、b
、c
。正如 Aniko 在评论中所写,您可以使用维恩图,例如 来自 R-forge 的 Vennerable。
安装需要 BioConductor 中的一些软件包:
您必须正确准备数据:
瞧:
一些额外的解释。
Vennerable 包的数据结构需要提供集合名称(在您的情况下为
"a"
、"b"
、"c"
)和频率/每个相交的比例。此 0/1 名称标识子集:1
表示“在集合中”,0
表示“不在集合中”。例如:100
表示在a
中,不在b
中,不在c
中,011 表示不在
a
中,在b
中,在c
中,所以
111
表示在所有三个集合中,即您的矩阵中缺少它,并且无法将其添加到那里。对于您的样本数据,当 a&b 有 0.7 重叠且 b&c 有 0.4 时,意味着至少 0.1 同时位于三个集合中(或者我错过了对这个数字的解释)。 (注意:我认为我高估了这个 0.5,因为它应该低于 0.4)您可以在创建矩阵之前将数据准备到维恩图,例如:
If you want overlapping then you missed one number - overlapping all three:
a
,b
,c
.As Aniko write in comment you could use Venn diagrams, e.g. Vennerable from R-forge.
Installation need some packages from BioConductor:
You mast prepare your data properly:
And voilà:
Some additional explanations.
Data structures for Vennerable package need to provide set names (
"a"
,"b"
,"c"
in your case) and frequencies/proportions of each intersects. This 0/1 names identify subsets:1
means "in set",0
means "not in set". So e.g.:100
means ina
, not inb
, not inc
,011
means not ina
, inb
, inc
So
111
means in all three sets, which is missing in your matrix and it can't be added there. For your sample data when a&b has 0.7 overlapping and b&c has 0.4 means that at least 0.1 is in three set at the same time (or I missed interpretation of this numbers). (note: I think I overestimated this 0.5, cause it should be lower than 0.4)You could prepare your data to Venn plot before creating matrix, e.g: