Lesson 3 of 20
The kind of data decides half the chart for you
categorical · ordinal · count · proportion · time · coordinate
“Which graph should I use?” is usually the wrong question. Ask first: what kind is each column of my data? Fix that and the shortlist drops to three or four.
| Kind | Example (in this paper) | Charts available |
|---|---|---|
| Categorical (names) | tumour types LUAD·LUSC·STAD / cell types T·B·NK | bars · dot plot · colour |
| Ordinal | TMB-L → TMB-H / stage I·II·III | bars (in order) · box |
| Count | 616 mutations / a count of 802 | histogram · scatter |
| Proportion | 3.03% TIL infiltration / cell composition | bars · box · (pie) |
| Time | day 0·3·6·…·21 after implantation | line · step |
| Coordinate | cell position in tissue / UMAP location | scatter · density · map |
Only
group is categorical; the rest are quantities. Writing down the kind of each column first makes the chart choice easy.
Python
Runs in your browser
The same column can change kind depending on what you are asking. The paper's TMB is the clean example.
As a quantity
how many per Mb → histogram. You see how skewed the distribution is
As an order
TMB-L / TMB-H split at 10 → two bars. That is Fig. 1B of the paper
The paper did both. The right half of Fig. 1B is the quantity (a box plot), the left half is the ordering (proportion bars). Drawing one column twice is not waste, it is honesty — they did not hide the original distribution after drawing a threshold through it.
🤔 Check yourself
You want to show mean TIL infiltration for thirteen tumour types. What fits best?
Answer Tumour type is categorical — nothing lies between two of them, so a connecting line is a false claim. Horizontal bars also read long names easily, and sorting makes the ranking immediate.
🤔 Check yourself
Tumour volume is measured on days 0, 3, 6, 9, 12, 15, 18 and 21. What should the x-axis do?
Answer Time is continuous. Only spacing proportionally makes the slope a real growth rate. This dataset happens to be evenly spaced so it looks the same — but for days 0, 1, 2, 7, 14, 28 it would not be.