gpt4 book ai didi

python - 如何修改matplotlib-venn中的字体大小

转载 作者:太空狗 更新时间:2023-10-29 21:26:21 57 4
gpt4 key购买 nike

我有以下维恩图:

from matplotlib import pyplot as plt
from matplotlib_venn import venn3, venn3_circles
set1 = set(['A', 'B', 'C', 'D'])
set2 = set(['B', 'C', 'D', 'E'])
set3 = set(['C', 'D',' E', 'F', 'G'])

venn3([set1, set2, set3], ('Set1', 'Set2', 'Set3'))

看起来像这样:

enter image description here

如何控制绘图的字体大小?我想增加它。

最佳答案

如果 outvenn3() 返回的对象,文本对象只是存储为 out.set_labelsout .subset_labels,所以你可以这样做:

from matplotlib import pyplot as plt
from matplotlib_venn import venn3, venn3_circles
set1 = set(['A', 'B', 'C', 'D'])
set2 = set(['B', 'C', 'D', 'E'])
set3 = set(['C', 'D',' E', 'F', 'G'])

out = venn3([set1, set2, set3], ('Set1', 'Set2', 'Set3'))
for text in out.set_labels:
text.set_fontsize(14)
for text in out.subset_labels:
text.set_fontsize(16)

关于python - 如何修改matplotlib-venn中的字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29426075/

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