konstantint / matplotlib-venn

Area-weighted venn-diagrams for Python/matplotlib
MIT License
495 stars 67 forks source link

How to set the Venn-diagram figure height #53

Closed shinokada closed 3 years ago

shinokada commented 3 years ago

I tried to change the figure height using different methods suggested here, but none of them worked.

As you can see in the image below, I want to add more space under A and B by changing the figure height.

What is the best way to do it?

%matplotlib inline
from matplotlib_venn import venn2
from matplotlib import pyplot as plt

v = venn2(subsets=(3, 3, 1))

# remove numbers
for area in ['01', '10', '11']:
  txt = v.get_label_by_id(area)
  if txt: txt.set_text('')

v.get_patch_by_id('10').set_color('skyblue')
v.get_patch_by_id('10').set_edgecolor('black')
v.get_patch_by_id('11').set_color('skyblue')
v.get_patch_by_id('11').set_edgecolor('black')
v.get_patch_by_id('01').set_color('skyblue')
v.get_patch_by_id('01').set_edgecolor('black')

plt.gca().set_axis_on()
plt.gca().set_facecolor('white')
plt.title("OR")
plt.show()

image

konstantint commented 3 years ago

Try this:

ymin, ymax = plt.gca().get_ylim()
plt.ylim(ymin - 0.5, ymax)
shinokada commented 3 years ago

Thanks. It works.