konstantint / matplotlib-venn

Area-weighted venn-diagrams for Python/matplotlib
MIT License
520 stars 68 forks source link

Option to set_text_color( 'white') #52

Closed shinokada closed 4 years ago

shinokada commented 4 years ago

I just want to show AND, OR, XOR, etc without any numbers. Is there a way not showing numbers?

If we can set the text color to white, it won't be shown. It will be nice to change text color, font size, etc.

For example, the following shows OR and I want to remove the numbers.

%matplotlib inline
from matplotlib_venn import venn2
from matplotlib import pyplot

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

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

pyplot.gca().set_axis_on()
pyplot.gca().set_facecolor('white')
pyplot.show()

image

konstantint commented 4 years ago

You can simply remove the contents of the respective text labels, e.g.:

v = venn2(subsets=(3, 3, 1))
for area in ['01', '10', '11']:
  txt = v.get_label_by_id(area)
  if txt: txt.set_text('')
shinokada commented 4 years ago

Thanks for the follow-up.