如何在matplotlib-venn中修改字体大小 [英] How to modify the font size in matplotlib-venn

查看:363
本文介绍了如何在matplotlib-venn中修改字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下维恩图:

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

看起来像这样:

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

How can I control the font size of the plot? I'd like to increase it.

推荐答案

如果outvenn3()返回的对象,则文本对象仅存储为out.set_labelsout.subset_labels,因此您可以执行以下操作:

If out is the object returned by venn3(), the text objects are just stored as out.set_labels and out.subset_labels, so you can do:

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)

这篇关于如何在matplotlib-venn中修改字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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