问题
I have the following Venn diagrams:
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'))
That looks like this:
How can I control the font size of the plot? I'd like to increase it.
回答1:
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)
来源:https://stackoverflow.com/questions/29426075/how-to-modify-the-font-size-in-matplotlib-venn