Learn practical skills, build real-world projects, and advance your career

Logic Venn Diagram on Jupyter

  • A
  • B
  • TRUE
  • FALSE
  • A AND B
  • A OR B
  • A XOR B
  • A NOR B
  • A XNOR B
  • NOT A
  • NOT B
  • A NOT B
  • B NOT A
  • A NAND B
  • A → B
  • B → A
  • Mutually exclusive
  • Negate and complement
  • Subset

image.png

A

# A
from matplotlib_venn import venn2, venn2_circles
from matplotlib import pyplot as plt
%matplotlib inline

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

for area in ['01', '10', '11']:
    color = 'magenta' if area != '01' else 'white'
    v.get_patch_by_id(area).set_color(color)
    v.get_patch_by_id(area).set_alpha(1)
    txt = v.get_label_by_id(area)
    if txt: txt.set_text('')

plt.gca().set_axis_on()
plt.gca().set_facecolor('white')
plt.title("A", fontsize=20)
ymin, ymax = plt.gca().get_ylim()
plt.ylim(ymin - 0.1, ymax)
plt.show()
Notebook Image

B