Pikchr

How to Draw Venn Diagrams 2
Login

How to Draw Venn Diagrams 2

(1.2) By pskechr on 2026-03-14 02:35:24 edited from 1.1 [source]

Hello,

This is partially a response to How to Draw Venn Diagrams, but also a response to my Proof-of-Concept of Macro as Part of Object Definition. Call outs to wyoung and zenomt for their prior work. This slightly modifies and incorporates my own prior work to draw the arc-bound overlapping areas in the center-top and center-bottom diagrams. It's a way to do it with true-enough arcs that scale well enough to larger sizes that (I think; I hope) someone could find useful and not prohibitively complex. These examples use 3-degree arc segments, which means more script tokens. Widening the arc segments does reduce the script tokens, but making the arc segments too big makes for "choppy" edges at larger sizes.

The "How to Draw Venn Diagrams" post specifically asked for Pikchrs to replicate those from an article about representing SQL Joins as Venn diagrams. My direct response to that is below. Obviously, these same diagrams are used in many ways, such as with logic and sets.

SQL Joins Represented as Venn Diagrams

SELECT *
FROM A
[INNER] JOIN B
   ON B.K = A.K

A B
define thenTo { \
   then to $3 heading $4+$5*$6 from UO+($1,$2) \
}

define thenToX4 { \
   thenTo($1,$2,$3,$4,$5,$6) \
   thenTo($1,$2,$3,$4,$5,$7) \
   thenTo($1,$2,$3,$4,$5,$8) \
   thenTo($1,$2,$3,$4,$5,$9) \
}

define thenArc120 { \
   thenToX4($1,$2,$3,$4,$5,  3,  6,  9, 12) \
   thenToX4($1,$2,$3,$4,$5, 15, 18, 21, 24) \
   thenToX4($1,$2,$3,$4,$5, 27, 30, 33, 36) \
   thenToX4($1,$2,$3,$4,$5, 39, 42, 45, 48) \
   thenToX4($1,$2,$3,$4,$5, 51, 54, 57, 60) \
   thenToX4($1,$2,$3,$4,$5, 63, 66, 69, 72) \
   thenToX4($1,$2,$3,$4,$5, 75, 78, 81, 84) \
   thenToX4($1,$2,$3,$4,$5, 87, 90, 93, 96) \
   thenToX4($1,$2,$3,$4,$5, 99,102,105,108) \
   thenToX4($1,$2,$3,$4,$5,111,114,117,120) \
}

UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill white
B: circle same at $R heading 90 from A
line from $R heading 30 from A.c \
thenArc120(A.c.x,A.c.y,$R,30,1) \
thenArc120(B.c.x,B.c.y,$R,210,1) \
close thin color none fill salmon
circle at A radius $R thin color black fill none
circle same at B
"A" with ne at A.sw
"B" with nw at B.se

SELECT *
FROM A
LEFT [OUTER] JOIN B
   ON B.K = A.K

A B
UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill salmon
B: circle same at $R heading 90 from A fill white behind A
circle at A radius $R thin color black fill none
circle same at B
"A" with ne at A.sw
"B" with nw at B.se

SELECT *
FROM A
FULL [OUTER] JOIN B
   ON B.K = A.K

A B
UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill salmon
B: circle same at $R heading 90 from A
circle at A radius $R thin color black fill none
circle same at B
"A" with ne at A.sw
"B" with nw at B.se

SELECT *
FROM A
RIGHT [OUTER] JOIN B
   ON B.K = A.K

A B
UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill white
B: circle same at $R heading 90 from A fill salmon
circle at A radius $R thin color black fill none
circle same at B
"A" with ne at A.sw
"B" with nw at B.se

SELECT *
FROM A
LEFT [OUTER] JOIN B
   ON B.K = A.K
WHERE B.K IS NULL

A B
UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill salmon
B: circle same at $R heading 90 from A fill white
circle at A radius $R thin color black fill none
circle same at B
"A" with ne at A.sw
"B" with nw at B.se

SELECT *
FROM A
FULL [OUTER] JOIN B
   ON B.K = A.K
WHERE A.K IS NULL
OR B.K IS NULL

A B
define thenTo { \
   then to $3 heading $4+$5*$6 from UO+($1,$2) \
}

define thenToX4 { \
   thenTo($1,$2,$3,$4,$5,$6) \
   thenTo($1,$2,$3,$4,$5,$7) \
   thenTo($1,$2,$3,$4,$5,$8) \
   thenTo($1,$2,$3,$4,$5,$9) \
}

define thenArc120 { \
   thenToX4($1,$2,$3,$4,$5,  3,  6,  9, 12) \
   thenToX4($1,$2,$3,$4,$5, 15, 18, 21, 24) \
   thenToX4($1,$2,$3,$4,$5, 27, 30, 33, 36) \
   thenToX4($1,$2,$3,$4,$5, 39, 42, 45, 48) \
   thenToX4($1,$2,$3,$4,$5, 51, 54, 57, 60) \
   thenToX4($1,$2,$3,$4,$5, 63, 66, 69, 72) \
   thenToX4($1,$2,$3,$4,$5, 75, 78, 81, 84) \
   thenToX4($1,$2,$3,$4,$5, 87, 90, 93, 96) \
   thenToX4($1,$2,$3,$4,$5, 99,102,105,108) \
   thenToX4($1,$2,$3,$4,$5,111,114,117,120) \
}

UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill salmon
B: circle same at $R heading 90 from A
line from $R heading 30 from A.c \
thenArc120(A.c.x,A.c.y,$R,30,1) \
thenArc120(B.c.x,B.c.y,$R,210,1) \
close thin color none fill white
circle at A radius $R thin color black fill none
circle same at B
"A" with ne at A.sw
"B" with nw at B.se

SELECT *
FROM A
RIGHT [OUTER] JOIN B
   ON B.K = A.K
WHERE A.K IS NULL

A B
UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill white
B: circle same at $R heading 90 from A fill salmon behind A
circle at A radius $R thin color black fill none
circle same at B
"A" with ne at A.sw
"B" with nw at B.se

Drawing 3-circle Venn diagrams is done very similarly, but there may be some effort in seeking the minimally sufficient solution for any given end-goal. The diagram below is drawn four ways, each requiring a different amount of work, and each being a potential solution for some more nuanced end-goal, especially regarding lobe coloring.

Number of
Arc-Edged Objects

With Number of
Arc-Origin Changes

With
Arc Angles

Number of Possible
Lobe Colors

Requires
Center Overlay

Diagram

43 with 2
1 with 3
120
60
3Yes

A B C
define thenTo { \
   then to $3 heading $4+$5*$6 from UO+($1,$2) \
}

define thenToX4 { \
   thenTo($1,$2,$3,$4,$5,$6) \
   thenTo($1,$2,$3,$4,$5,$7) \
   thenTo($1,$2,$3,$4,$5,$8) \
   thenTo($1,$2,$3,$4,$5,$9) \
}

define thenArc60 { \
   thenToX4($1,$2,$3,$4,$5,  3,  6,  9, 12) \
   thenToX4($1,$2,$3,$4,$5, 15, 18, 21, 24) \
   thenToX4($1,$2,$3,$4,$5, 27, 30, 33, 36) \
   thenToX4($1,$2,$3,$4,$5, 39, 42, 45, 48) \
   thenToX4($1,$2,$3,$4,$5, 51, 54, 57, 60) \
}

define thenArc120 { \
   thenArc60($1,$2,$3,$4,$5) \
   thenToX4($1,$2,$3,$4,$5, 63, 66, 69, 72) \
   thenToX4($1,$2,$3,$4,$5, 75, 78, 81, 84) \
   thenToX4($1,$2,$3,$4,$5, 87, 90, 93, 96) \
   thenToX4($1,$2,$3,$4,$5, 99,102,105,108) \
   thenToX4($1,$2,$3,$4,$5,111,114,117,120) \
}

UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill white
B: circle same at $R heading 90 from A
C: circle same at $R heading 150 from A

line from $R heading 30 from A \
thenArc120(A.c.x,A.c.y,$R,30,1) \
thenArc120(B.c.x,B.c.y,$R,210,1) \
close thin color none fill salmon

line from $R heading 150 from B \
thenArc120(B.c.x,B.c.y,$R,150,1) \
thenArc120(C.c.x,C.c.y,$R,330,1) \
close thin color none fill salmon

line from $R heading 270 from C \
thenArc120(C.c.x,C.c.y,$R,270,1) \
thenArc120(A.c.x,A.c.y,$R,90,1) \
close thin color none fill salmon

line from $R heading 330 from C \
thenArc60(C.c.x,C.c.y,$R,330,1) \
thenArc60(A.c.x,A.c.y,$R,90,1) \
thenArc60(B.c.x,B.c.y,$R,210,1) \
close thin color none fill white

circle at A radius $R thin color black fill none
circle same at B
circle same at C
"A" with se at A.nw
"B" with sw at B.ne
"C" with ne at C.sw

33 with 3603No

A B C
define thenTo { \
   then to $3 heading $4+$5*$6 from UO+($1,$2) \
}

define thenToX4 { \
   thenTo($1,$2,$3,$4,$5,$6) \
   thenTo($1,$2,$3,$4,$5,$7) \
   thenTo($1,$2,$3,$4,$5,$8) \
   thenTo($1,$2,$3,$4,$5,$9) \
}

define thenArc60 { \
   thenToX4($1,$2,$3,$4,$5,  3,  6,  9, 12) \
   thenToX4($1,$2,$3,$4,$5, 15, 18, 21, 24) \
   thenToX4($1,$2,$3,$4,$5, 27, 30, 33, 36) \
   thenToX4($1,$2,$3,$4,$5, 39, 42, 45, 48) \
   thenToX4($1,$2,$3,$4,$5, 51, 54, 57, 60) \
}

UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill white
B: circle same at $R heading 90 from A
C: circle same at $R heading 150 from A

line from $R heading 270 from B \
thenArc60(B.c.x,B.c.y,$R,270,1) \
thenArc60(A.c.x,A.c.y,$R,30,1) \
thenArc60(C.c.x,C.c.y,$R,30,-1) \
close thin color none fill salmon

line from $R heading 30 from C \
thenArc60(C.c.x,C.c.y,$R,30,1) \
thenArc60(B.c.x,B.c.y,$R,150,1) \
thenArc60(A.c.x,A.c.y,$R,150,-1) \
close thin color none fill salmon

line from $R heading 150 from A \
thenArc60(A.c.x,A.c.y,$R,150,1) \
thenArc60(C.c.x,C.c.y,$R,270,1) \
thenArc60(B.c.x,B.c.y,$R,270,-1) \
close thin color none fill salmon

circle at A radius $R thin color black fill none
circle same at B
circle same at C
"A" with se at A.nw
"B" with sw at B.ne
"C" with ne at C.sw

21 with 6
1 with 3
601Yes

A B C
define thenTo { \
   then to $3 heading $4+$5*$6 from UO+($1,$2) \
}

define thenToX4 { \
   thenTo($1,$2,$3,$4,$5,$6) \
   thenTo($1,$2,$3,$4,$5,$7) \
   thenTo($1,$2,$3,$4,$5,$8) \
   thenTo($1,$2,$3,$4,$5,$9) \
}

define thenArc60 { \
   thenToX4($1,$2,$3,$4,$5,  3,  6,  9, 12) \
   thenToX4($1,$2,$3,$4,$5, 15, 18, 21, 24) \
   thenToX4($1,$2,$3,$4,$5, 27, 30, 33, 36) \
   thenToX4($1,$2,$3,$4,$5, 39, 42, 45, 48) \
   thenToX4($1,$2,$3,$4,$5, 51, 54, 57, 60) \
}

UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill white
B: circle same at $R heading 90 from A
C: circle same at $R heading 150 from A

line from $R heading 270 from B \
thenArc60(B.c.x,B.c.y,$R,270,1) \
thenArc60(A.c.x,A.c.y,$R,30,1) \
thenArc60(C.c.x,C.c.y,$R,30,1) \
thenArc60(B.c.x,B.c.y,$R,150,1) \
thenArc60(A.c.x,A.c.y,$R,150,1) \
thenArc60(C.c.x,C.c.y,$R,270,1) \
close thin color none fill salmon

line from $R heading 330 from C \
thenArc60(C.c.x,C.c.y,$R,330,1) \
thenArc60(A.c.x,A.c.y,$R,90,1) \
thenArc60(B.c.x,B.c.y,$R,210,1) \
close thin color none fill white

circle at A radius $R thin color black fill none
circle same at B
circle same at C
"A" with se at A.nw
"B" with sw at B.ne
"C" with ne at C.sw

11 with 9601No

A B C
define thenTo { \
   then to $3 heading $4+$5*$6 from UO+($1,$2) \
}

define thenToX4 { \
   thenTo($1,$2,$3,$4,$5,$6) \
   thenTo($1,$2,$3,$4,$5,$7) \
   thenTo($1,$2,$3,$4,$5,$8) \
   thenTo($1,$2,$3,$4,$5,$9) \
}

define thenArc60 { \
   thenToX4($1,$2,$3,$4,$5,  3,  6,  9, 12) \
   thenToX4($1,$2,$3,$4,$5, 15, 18, 21, 24) \
   thenToX4($1,$2,$3,$4,$5, 27, 30, 33, 36) \
   thenToX4($1,$2,$3,$4,$5, 39, 42, 45, 48) \
   thenToX4($1,$2,$3,$4,$5, 51, 54, 57, 60) \
}

UO: (0,0)
$R = 0.375in
A: circle at UO radius $R color none fill white
B: circle same at $R heading 90 from A
C: circle same at $R heading 150 from A

line from $R heading 270 from B \
thenArc60(B.c.x,B.c.y,$R,270,1) \
thenArc60(A.c.x,A.c.y,$R,30,1) \
thenArc60(C.c.x,C.c.y,$R,30,1) \
thenArc60(B.c.x,B.c.y,$R,150,1) \
thenArc60(A.c.x,A.c.y,$R,150,1) \
thenArc60(C.c.x,C.c.y,$R,270,1) \
thenArc60(B.c.x,B.c.y,$R,270,-1) \
thenArc60(A.c.x,A.c.y,$R,150,-1) \
thenArc60(C.c.x,C.c.y,$R,30,-1) \
close thin color none fill salmon

circle at A radius $R thin color black fill none
circle same at B
circle same at C
"A" with se at A.nw
"B" with sw at B.ne
"C" with ne at C.sw

While it does require a bit more code, these methods do produce some nice looking diagrams, such as this humbly offered update to the Pikchrshow "The Stuff of Dreams" example diagram.

The Stuff of Dreams

Original

Update

DREAMS INEXPENSIVE FAST HIGH QUALITY EXPENSIVE SLOW POOR QUALITY
O: text "DREAMS" color grey
circle rad 0.9 at 0.6 above O thick color red
text "INEXPENSIVE" big bold at 0.9 above O color red
circle rad 0.9   at 0.6 heading  120 from O thick color green
text "FAST" big bold at 0.9 heading  120 from O  color green
circle rad 0.9 at 0.6 heading -120 from O thick color blue
text "HIGH" big bold "QUALITY" big bold at 0.9 heading  -120 from O  color blue
text "EXPENSIVE" at 0.55 below O  color cyan
text "SLOW" at 0.55 heading  -60 from O  color magenta
text "POOR" "QUALITY" at 0.55 heading   60 from O  color gold

INEXPENSIVE FAST HIGH QUALITY EXPENSIVE SLOW POOR QUALITY DREAMS
define thenTo { \
   then to $3 heading $4+$5*$6 from UO+($1,$2) \
}

define thenToX4 { \
   thenTo($1,$2,$3,$4,$5,$6) \
   thenTo($1,$2,$3,$4,$5,$7) \
   thenTo($1,$2,$3,$4,$5,$8) \
   thenTo($1,$2,$3,$4,$5,$9) \
}

define thenArc60 { \
   thenToX4($1,$2,$3,$4,$5,  3,  6,  9, 12) \
   thenToX4($1,$2,$3,$4,$5, 15, 18, 21, 24) \
   thenToX4($1,$2,$3,$4,$5, 27, 30, 33, 36) \
   thenToX4($1,$2,$3,$4,$5, 39, 42, 45, 48) \
   thenToX4($1,$2,$3,$4,$5, 51, 54, 57, 60) \
}

UO: (0,0)
$R = 0.9in
A: circle at UO radius $R thick color none fill Pink
B: circle same at $R heading 210 from A fill LightBlue
C: circle same at $R heading 150 from A fill LightGreen

line from $R heading 210 from A \
thenArc60(A.c.x,A.c.y,$R,210,1) \
thenArc60(B.c.x,B.c.y,$R,330,1) \
thenArc60(C.c.x,C.c.y,$R,330,-1) \
close color none fill Violet

line from $R heading 330 from C \
thenArc60(C.c.x,C.c.y,$R,330,1) \
thenArc60(A.c.x,A.c.y,$R,90,1) \
thenArc60(B.c.x,B.c.y,$R,90,-1) \
close color none fill SandyBrown

line from $R heading 90 from B \
thenArc60(B.c.x,B.c.y,$R,90,1) \
thenArc60(C.c.x,C.c.y,$R,210,1) \
thenArc60(A.c.x,A.c.y,$R,210,-1) \
close color none fill MediumAquamarine

line from $R heading 30 from B \
thenArc60(B.c.x,B.c.y,$R,30,1) \
thenArc60(A.c.x,A.c.y,$R,150,1) \
thenArc60(C.c.x,C.c.y,$R,270,1) \
close color none fill LightGray

circle at A radius $R color black fill none
circle same at B
circle same at C

"INEXPENSIVE" big bold at $R/2.25 heading 0 from A
"FAST" big bold at $R/2 heading 110 from C
"HIGH" big bold "QUALITY" big bold at $R/2.05 heading 250 from B
"EXPENSIVE" bold at $R*1.1875 heading 180 from A
"SLOW" bold at $R*1.29 heading 301.5 from C
"POOR" bold "QUALITY" bold at $R*1.33 heading 59 from B
"DREAMS" big bold at $R/1.75 heading 180 from A

I hope some of this is useful to someone. Thanks for reading, reviewing, and any comments.

Edit: Changed structure of first table for hopefully better appearance on mobile devices. Edit #2: Restored table, can't make it work.

(2) By Stephan Beal (stephan) on 2026-03-13 08:21:03 in reply to 1.0 [link] [source]

My direct response to that is below...

Truly a thing of beauty, and bookmarked for later reference.

(3) By spindrift on 2026-03-13 13:53:42 in reply to 2 [link] [source]

Seconded.

(4) By Warren Young (wyoung) on 2026-03-14 02:46:21 in reply to 1.2 [link] [source]

Okay, you win Internet today.