Python: matplotlib-venn - How do you adjust the position / move the values inside the venn diagram circles?

4.8k views Asked by At

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

Here's a sample venn diagram:

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

There are 1 answers

0
Afflatus On

I figured this out by looking at the code found in this question: Venn3: How to reposition circles and labels?

Specifically, this part:

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

Putting it all together (see how that 1 is all the way to the right now...):

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

There appear to be a lot of other things one can set about that number. A full list of all applicable callable methods can be found by running:

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