Sub topic 2
Thematic analysis and affinity mapping: how they relate
Prerequisites
This chapter assumes you have run or observed a few research sessions, such as interviews or usability tests. It also assumes you have taken notes and know the difference between qualitative data (what people said, did, and felt) and quantitative data (counts and measurements). You do not need prior experience with coding or affinity maps. This chapter explains both.
Two names for overlapping work
Research teams use "thematic analysis" and "affinity mapping" as if they were the same thing. They are related, but they are not the same.
- Thematic analysis is a method for finding patterns of meaning in qualitative data and reporting them as themes. It describes a whole analysis, from reading the data to writing up the results.
- Affinity mapping is a technique for grouping items by similarity. You put each observation on a card or sticky note, then move related cards close together until clusters appear.
Affinity mapping is one way to do the grouping step inside a thematic analysis. Thematic analysis is the larger process and affinity mapping is a tool you can use within it.
You can use an affinity map without any thematic rigor. A team might sort sticky notes quickly in a workshop and call the piles "themes." You can also do thematic analysis without a wall of sticky notes, for example by coding transcripts in a spreadsheet. This tutorial combines the two. You will use the discipline of thematic analysis (coding, review, traceability) and the visual, hands-on grouping of affinity mapping.
What each one contributes
| Aspect | Thematic analysis | Affinity mapping |
|---|---|---|
| Scope | The whole path from raw data to reported themes | The grouping step |
| Main question | What patterns of meaning does the data show? | Which observations belong together? |
| Typical unit | Coded data segments | One observation per card |
| Output | Defined, named themes backed by evidence | Labeled clusters on a board |
| Strength | Rigor, consistency, a record of decisions | Speed, visibility, easy teamwork |
| Weakness | Can be slow and solitary | Can stay shallow without coding or review |
The two methods cover each other's weak points. Coding makes the groups more careful. The map makes the groups visible and open to discussion.
How the pieces fit together
The workflow in this tutorial has these stages:
- Turn raw notes into atomic observations.
- Read through them to become familiar with the data.
- Open code each observation.
- Cluster observations bottom-up on an affinity map.
- Label the clusters.
- Turn clusters into themes, and check that they are themes and not just topics.
- Review themes against the data, then define and name them.
- Report the themes as insights.
Coding and clustering are two routes to grouping. Codes are short labels you attach to observations. Clusters are physical or digital groups of observations. In practice the two feed each other. Codes suggest what belongs together, and clusters show you where a code is too broad or too narrow.
The shared unit: the atomic observation
Both methods work best when each item is one observation. An atomic observation is a single, self-contained statement about what a participant did, said, or experienced. It makes sense without the rest of the session, and it points back to its source.
In the example data used throughout this tutorial, each note has an id, a participant, and one or more codes. Grouping note ids by code gives the first view of what could be clustered.
from collections import defaultdict
notes = [
{"id": "n1", "participant": "P1", "text": "Skipped the setup tour because it felt long.", "codes": ["setup_friction"]},
{"id": "n2", "participant": "P2", "text": "Could not find where to import old data.", "codes": ["setup_friction", "navigation_confusion"]},
{"id": "n3", "participant": "P2", "text": "Asked a coworker how to share a board.", "codes": ["sharing_unclear"]},
{"id": "n4", "participant": "P3", "text": "Gave up looking for the export button.", "codes": ["navigation_confusion"]},
]
by_code = defaultdict(list)
for note in notes:
for code in note["codes"]:
by_code[code].append(note["id"])
for code, ids in sorted(by_code.items()):
print(code, ids)Running this prints one line per code:
navigation_confusion ['n2', 'n4']
setup_friction ['n1', 'n2']
sharing_unclear ['n3']Note that n2 appears under two codes. One observation can belong to more than one group. On a physical wall you would handle this by duplicating the card or by choosing the group where it matters most and recording the other link.
Where themes come from
A code describes a piece of data. A theme interprets a pattern across the data. The step from codes to themes is where thematic analysis adds the most beyond a simple sort.
Consider the codes setup_friction and navigation_confusion. Together they could support a theme such as "Getting started takes more effort than people expect." That sentence says something about meaning. It is not just a topic name such as "Onboarding."
The next example maps codes to themes. For each theme, it lists the supporting notes and counts the distinct participants behind it. This keeps each theme tied to its evidence.
from collections import defaultdict
notes = [
{"id": "n1", "participant": "P1", "codes": ["setup_friction"]},
{"id": "n2", "participant": "P2", "codes": ["setup_friction", "navigation_confusion"]},
{"id": "n3", "participant": "P2", "codes": ["sharing_unclear"]},
{"id": "n4", "participant": "P3", "codes": ["navigation_confusion"]},
]
themes = {
"Getting started takes more effort than people expect": ["setup_friction", "navigation_confusion"],
"Collaboration features are hard to discover": ["sharing_unclear"],
}
for theme, codes in themes.items():
evidence = [n for n in notes if set(n["codes"]) & set(codes)]
participants = {n["participant"] for n in evidence}
print(theme, "| notes:", [n["id"] for n in evidence], "| participants:", len(participants))The output is:
Getting started takes more effort than people expect | notes: ['n1', 'n2', 'n4'] | participants: 3
Collaboration features are hard to discover | notes: ['n3'] | participants: 1The first theme rests on three notes from three participants. The second rests on one note from one participant. That second theme is a weak candidate. You would either look for more evidence, merge it into a broader theme, or report it as tentative. Counting participants, not just notes, matters because one talkative participant can produce many notes and make a pattern look stronger than it is. Here P2 contributed two notes to the first theme but counts once.
Approaches that shape the analysis
Thematic analysis can be inductive or deductive. An inductive approach builds themes from the data with no fixed expectations. A deductive approach starts with a framework or research questions and looks for evidence about them. Affinity mapping is naturally inductive, because you let clusters form from the cards. If your team has specific questions, such as "Where do people get stuck during setup?", you can still map inductively and then check the clusters against those questions. A later chapter covers this choice in detail.
What can go wrong when you combine them
- Mapping without coding. Groups form from first impressions and the first card placed. The labels stay as topics, such as "Sharing," and never reach a claim about meaning.
- Coding without mapping. The codes live in a list that nobody can see as a whole, so the team cannot easily challenge or reshape them.
- Treating clusters as final themes. A cluster is a candidate. It still needs review against the data, a clear definition, and a name.
- Losing the source. If cards carry no participant or session reference, you cannot check a theme later or answer "who said that?"
- Counting the wrong thing. Reporting that "a theme appeared in 12 notes" says little unless you also say how many people stood behind them.
Exercise
A teammate says, "We already did thematic analysis. We put sticky notes on a wall and grouped them into piles." What two things would you check before agreeing, and why?
Show answer
First, check whether the observations were atomic and traceable to a participant and session. Without that, you cannot verify the piles against the data. Second, check whether the piles were reviewed and turned into statements about meaning, not just topic names. Grouping alone is the affinity mapping technique. Thematic analysis also needs coding or equivalent interpretation, review against the data, and defined, named themes.
Exercise
A theme is supported by 9 notes. All 9 come from one participant. Using the approach in this chapter, how would you handle the theme in your report?
Show answer
Count the distinct participants, which here is 1. A pattern from one person is not yet a pattern across users. Look for further evidence in other sessions. If none exists, merge it into a broader theme where it fits, or report it as a single-participant observation and label it tentative.