简体   繁体   English

Python:matplotlib-venn-如何在venn图圆内调整位置/移动值?

[英]Python: matplotlib-venn - How do you adjust the position / move the values inside the venn diagram circles?

如何在维恩图圆内移动值?

Here's a sample venn diagram: 这是一个示例维恩图:

from matplotlib import pyplot as plt
import numpy as np
from matplotlib_venn import venn3, venn3_circles
plt.figure(figsize=(4,4))
vd = venn3(subsets=(1, 1, 1, 1, 1, 1, 1), set_labels = ('A', 'B', 'C'))

plt.show()

I figured this out by looking at the code found in this question: Venn3: How to reposition circles and labels? 通过查看在以下问题中找到的代码,我弄清楚了这一点: Venn3:如何重新放置圆圈和标签?

Specifically, this part: 具体来说,这部分内容:

vd.get_label_by_id("100").set_x(1.55)

Putting it all together (see how that 1 is all the way to the right now...): 将所有内容放在一起(请参阅如何将1一直显示到现在...):

from matplotlib import pyplot as plt
import numpy as np
from matplotlib_venn import venn3, venn3_circles
plt.figure(figsize=(4,4))
vd = venn3(subsets=(1, 1, 1, 1, 1, 1, 1), set_labels = ('A', 'B', 'C'))

#Move the numbers in the circles                                                                                                                                               
vd.get_label_by_id("100").set_x(1.55)

plt.show()

在此处输入图片说明

There appear to be a lot of other things one can set about that number. 关于这个数字,还有很多其他事情可以设定。 A full list of all applicable callable methods can be found by running: 通过运行以下命令,可以找到所有适用的可调用方法的完整列表:

x = venn_diagram.get_label_by_id("100")
dir(x)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM