Skip to content
Connect an agent

Other diagram kinds

Venn diagrams

A Venn diagram draws two to four sets as overlapping shapes, so the reader sees what each set holds alone and what the sets share. Use it for team ownership, feature coverage across products or plans, overlapping skills, or audiences that use more than one channel. It is for anyone who has to show where groups meet, and for an agent asked to compare a few groups by what they have in common.

TL;DR

QuestionAnswer
What is it for?A few groups and what they share: who owns what, which plan has which feature, who uses which app.
How do I start one?Write venn "Title", a set line for each group, an overlap line for each overlap worth naming, and an item line for each member.
How is an item placed?item fe be "GraphQL schema" puts it in the region of exactly the sets named: in Frontend and Backend, and in no other set.
How many sets?One to four. Four are drawn as ellipses, the only arrangement where all fifteen overlaps show.
What if text does not fit?A region too small for its text shows a numbered badge, and its items are listed beside the diagram under the same number. Nothing overflows.
What does Mermaid convert?venn-beta and venn: sets, unions, text lines, and sizes. See From Mermaid.
How big can it be?At most 4 sets and 80 items. Warnings start past 6 items in one region and 24 in all.
How is it drawn?Each set a soft wash of its tone with an outline, so overlaps read darker. The set names sit in tabs outside the shapes, and each region's name and items are centred in it.

Ask your agent

text
Use Plotwork to draw a Venn diagram of who owns what between the Frontend, Backend and Platform teams. Name the overlap of Frontend and Backend "API contracts" and the overlap of all three "On-call", and put each piece of work in the region of the teams that share it.
text
Use Plotwork to draw a Venn diagram, to scale, of the users of our web app and our mobile app: 900 on the web, 500 on mobile, and 200 who use both.

Example

Three teams, the work each owns alone, the two overlaps that have a name, and the work they share. Each set has a tone and an icon; without them the sets take blue, violet, aqua and orange in turn.

Two sets to scale

With sizes=on, two sets are drawn to scale: each circle's area is its set's size=, and the overlap's area is the overlap's size=. The numbers are written in the tabs and the overlap.

Four sets

Four sets are drawn as four tilted ellipses, so every combination has a region. The smallest regions are small, so name only the overlaps that matter; a region that cannot hold its text shows a number, and the key beside the shapes lists it.

The language

One statement to a line. Text is always in double quotes, options are key=value, and # starts a comment.

The header

venn "Title" sizes=off desc="<text>". The title, sizes= and desc= are optional. sizes=on draws two sets to scale; with sizes=off, the default, the shapes are equal and any sizes are written as numbers.

Statements

StatementMeaningExample
set <id> "<Label>" size=<n> tone=<tone> icon=<icon>A set. The label defaults to the id.set fe "Frontend" tone=blue icon=lucide:monitor
overlap <id> <id> "<Name>" size=<n>Names the region where two or more sets overlap.overlap fe be "API contracts"
item <id> "<Text>"A member of the region of exactly the sets named.item fe be "GraphQL schema"
desc "<text>"The plain-language description, the same as desc= on the header.desc "Three teams and the work they share."

Sets

A set has an id, which overlaps and items name, and a label, which is drawn in a tab outside its shape. Give it a tone= for what it means and an icon= when a glyph helps; the tab shows the icon, the label and the size. One set is a circle, two are side by side, three sit on a triangle, and four are tilted ellipses. A fifth set is refused, because five shapes cannot show every overlap in a way a reader can follow: use a matrix instead.

Overlaps and items

An overlap names a region of two or more sets, and its name is drawn in that region. The order of the ids does not matter, and each region is named once. An item lives in the region of exactly the sets it names: item fe "Design system" is in Frontend and no other set, and item fe be ops "Incident drills" is in all three. An overlap or item may name a set declared further down.

Each region's text is centred in it and kept 8px from every outline. When a region cannot hold its items, its name stays if it fits, a numbered badge marks the region, and the items are listed in a key beside the shapes under that number. The key keeps the full text.

Sizes

size= on a set or an overlap is a plain number, such as 30 or 2.5. With sizes=off the number is written in the set's tab and under the overlap's name. With sizes=on and two sets that both have a size, the circles are drawn to scale; an overlap of size=0 parts them, and its items go to the key. Three or four sets cannot be drawn to scale with circles, so they stay equal and lint says so. A set far smaller than the other is drawn at a third of the larger radius so its text has room, and lint says that too.

Limits and warnings

LimitValueWhat happens past it
Sets4E140 at the fifth set, with the advice to use a matrix.
Items80E140 before any layout.
Items in one region before the warning6W200, at the first item.
Items in all before the warning24W200.
Region text150px, then 112px, then 80px wide; 3 lines an item, 2 a nameText that does not fit at any width goes to the key, with W200.
Set label240pxCut with an ellipsis past that, with W203.

Every mistake comes back as a result with a code, a line, a column, and a hint. Warnings never stop the drawing.

CodeWhen it firesFix
E100A set with no id, an overlap of fewer than two sets, an item in no set, a set named twice on one line, text with nothing in it, or a diagram with no sets.Read the hint, which gives the form to write.
E130A set id used twice, or a region named twice.Give each set its own id, and name each region once.
E131An overlap or item names an id no set has.Use one of the ids the hint lists.
E136A size= that is not a plain number, or a sizes= that is neither on nor off.Write size=30, and sizes=on or sizes=off.
E140More than 4 sets or 80 items.Use a matrix, or keep the items that make the point.
E110, E121, E135, W208The shared codes: an unknown statement (a line of Mermaid names the converter), an unknown tone, an unknown option, and an unknown icon.Read the hint.
W200A crowded region or diagram, a region listed in the key, an overlap larger than one of its sets, or what sizes=on could not draw to scale.Shorten or move items, check the numbers, or use two sets.
W202The picture is wider than a Markdown column and its text would shrink.Shorten the items, or move the longest to the text around the diagram.
W203Text was cut with an ellipsis: a set label past 240px, or one long word past 220px.Shorten it. The outline keeps the full text.

From Mermaid

Mermaid's Venn diagram (venn-beta, and venn) converts to a Venn diagram. Ask your agent to convert it, or use the convert_mermaid tool. The migration guide covers the converter in full.

Mermaid
venn-beta  title Team overlap  set A["Frontend"]    text A1["React"]    text A2["Design Systems"]  set B["Backend"]    text B1["API"]  union A,B["Shared"]    text AB1["OpenAPI"]

It becomes:

Plotwork
venn "Team overlap"
set A "Frontend"set B "Backend"
overlap A B "Shared"
item A "React"item A "Design Systems"item B "API"item A B "OpenAPI"
MermaidPlotworkReported
venn-beta, vennvenn "<title>"
set A["Label"]:30set A "Label" size=30
set "Foo Bar"set foo_bar "Foo Bar", an id made from the nameM206
union A,B["Label"]:8overlap A B "Label" size=8
union A,B with no nameits text lines become item A B lines, and its size is droppedM203 for the size
text T["Label"] under a set or unionitem A "Label", or item A B "Label"
Two sets that both have a sizesizes=on, since Mermaid draws sizes to scale
style A fill:...the nearest tone; anything else the line sets is droppedM204, M200
style on a union or a text linedroppedM200
A union of a set no line declaresdroppedM203
More than four setsrefusedM102

A text line belongs to the latest set or union above it. Then give each set a tone and an icon, and name the overlaps that mean something.

See also

DocWhy
Writing diagramsThe flow, sequence and schema languages, and the rules every kind shares
MatricesMore than four groups, or many items, as rows and columns
Quadrant chartsPlace items on two scales instead of in groups
Migrating from MermaidConvert existing Mermaid diagrams, and what is dropped
Language referenceEvery kind, node type, option and diagnostic
Diagram kindsThe kinds Plotwork draws and the header of each