Venn Diagrams

Helmut Knaust, Department of Mathematical Sciences, UTEP, El Paso TX 79968
hknaust@utep.edu
11/11/2011

Two Sets

a=(((-(1/2)+x))^2)+(y^2)<1;
b=((((1/2)+x))^2)+(y^2)<1;
Table[RegionPlot[f[a,b],{x,-2,2},{y,-2,2},PlotLabel->f],{f,{And,Or,Xor,Implies,Nand,Nor}}]

RegionPlot[Implies[a,b],{x,-2,2},{y,-2,2},FrameTicks->None,Frame->True,PlotStyle->Gray,BaseStyle->{Bold,16},Frame->False,PlotPoints->80,PlotRange->{{-2,2},{-1.8,1.8}},AspectRatio->Automatic,Epilog->{Text["U",{1.8,1.6}],Text["A",{-1,0}],Text["B",{1,0}],Circle[{1/2,0},1],Circle[{-1/2,0},1]}]

Three Sets

a=(((x-(1/2)))^2)+(((y+((Sqrt[3])/4)))^2)<1;
b=(((x+(1/2)))^2)+(((y+((Sqrt[3])/4)))^2)<1;
c=(x^2)+(((y-((Sqrt[3])/4)))^2)<1;
Table[RegionPlot[f[a, b, c], {x, -2, 2}, {y, -2, 2}, PlotLabel -> f], {f, {And, Or, Xor, Nand, Nor}}]

RegionPlot[Or[And[a,b],c],{x,-2,2},{y,-2,2},FrameTicks->None,Frame->True,PlotStyle->Gray,BaseStyle->{Bold,16},Frame->False,PlotPoints->80,PlotRange->{{-2,2},{-1.8,1.8}},AspectRatio->Automatic,Epilog->{Text["U",{1.8,1.6}],Text["A",{-1,-Sqrt[3]/2}],Text["B",{1,-Sqrt[3]/2}],Text["C",{0,1}],Circle[{1/2,-Sqrt[3]/4},1],Circle[{-1/2,-Sqrt[3]/4},1],Circle[{0,Sqrt[3]/4},1]}]

p1=RegionPlot[And[a,b],{x,-2,2},{y,-2,2},FrameTicks->None,Frame->True,PlotStyle->{Opacity[.5],Black},BaseStyle->{Bold,16},Frame->False,PlotPoints->80,PlotRange->{{-2,2},{-1.8,1.8}},AspectRatio->Automatic,Epilog->{Text["U",{1.8,1.6}],Text["A",{-1,-Sqrt[3]/2}],Text["B",{1,-Sqrt[3]/2}],Text["C",{0,1}],Circle[{1/2,-Sqrt[3]/4},1],Circle[{-1/2,-Sqrt[3]/4},1],Circle[{0,Sqrt[3]/4},1]}];
p2=RegionPlot[c,{x,-2,2},{y,-2,2},FrameTicks->None,Frame->True,PlotStyle->{Opacity[.5],Black},BaseStyle->{Bold,16},Frame->False,PlotPoints->80,PlotRange->{{-2,2},{-1.8,1.8}},AspectRatio->Automatic,Epilog->{Text["U",{1.8,1.6}],Text["A",{-1,-Sqrt[3]/2}],Text["B",{1,-Sqrt[3]/2}],Text["C",{0,1}],Circle[{1/2,-Sqrt[3]/4},1],Circle[{-1/2,-Sqrt[3]/4},1],Circle[{0,Sqrt[3]/4},1]}];
Show[p1,p2]

Reference

Adapted from help topic ‘ref/RegionPlot’