gpt4 book ai didi

Python:matplotlib-venn - 如何调整位置/移动维恩图圆圈内的值?

转载 作者:太空宇宙 更新时间:2023-11-04 08:45:02 28 4
gpt4 key购买 nike

How do you move the values inside the venn diagram circles?

这是维恩图示例:

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()

最佳答案

我通过查看这个问题中的代码弄明白了这一点:Venn3: How to reposition circles and labels?

具体来说,这部分:

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

将它们放在一起(看看现在 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()

enter image description here

关于这个数字,似乎还有很多其他的事情可以设置。可以通过运行找到所有适用的可调用方法的完整列表:

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

关于Python:matplotlib-venn - 如何调整位置/移动维恩图圆圈内的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41475542/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com