如何修改 Matplotlib-venn 中的字体大小?
要修改 Matplotlib-venn 中的字体大小,我们可以使用set_fontsize()方法。
步骤
- 设置图形大小并调整子图之间的及周围的填充。
- 为韦恩图创建三个集合。
- 绘制一个 3 集合面积加权的韦恩图。
- 要设置set_labels和subset_labels字体大小,我们可以使用set_fontsize()方法。
- 要显示图形,请使用show()方法。
示例
from matplotlib import pyplot as plt
from matplotlib_venn import venn3
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
set1 = {'a', 'b', 'c', 'd'}
set2 = {'a', 'b', 'e'}
set3 = {'a', 'd', 'f'}
out = venn3([set1, set2, set3], ('Set1', 'Set2', 'Set3'))
for text in out.set_labels:
text.set_fontsize(25)
for text in out.subset_labels:
text.set_fontsize(12)
plt.show()输出

广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP