STEP 12 / 14

資料視覺化與報告

告別 bar±SEM——SuperPlots、color-blind palette 與資料敘事。

Goodbye bar±SEM — SuperPlots, color-blind palettes, and data storytelling.

為什麼長條圖+errorbar 該退役?

Weissgerber et al. 2015 在 PLOS Biology 的「Beyond Bar and Line Graphs」一文成為里程碑——同一組平均值 + SEM 可能對應截然不同的資料分布(單峰、雙峰、含 outlier)。務必顯示每個資料點。Lord et al. 2020 (JCB) 提出 SuperPlots:以顏色標示不同生物重複的細胞層級資料,同時呈現技術與生物變異。

Tufte 的「data-ink ratio」與 Wilke 2019 Fundamentals of Data Visualization 強調:去除多餘裝飾,用最少 ink 表達最多資訊。color-blind 友善的調色板(viridis 與 Okabe-Ito 8 色)已是現代期刊要求。

Weissgerber et al. 2015 (PLOS Biology) "Beyond Bar and Line Graphs" became a manifesto — identical mean + SEM can hide unimodal, bimodal, or outlier-laden distributions. Always show every data point. Lord et al. 2020 (JCB) introduced SuperPlots: color-code biological replicates and show cell-level + replicate-level variation together.

Tufte's "data-ink ratio" and Wilke 2019 Fundamentals of Data Visualization stress: remove chart junk, maximize information per ink. Color-blind-safe palettes (viridis, Okabe-Ito 8 colors) are now journal requirements.

💡
三條金律:(1) 顯示原始點 (geom_jitter / stripplot);(2) 標示 n 值與獨立實驗數;(3) 4 個以上集合用 UpSet plot 不要用 Venn diagram (Lex 2014, IEEE TVCG)。Three golden rules: (1) Show raw points (geom_jitter / stripplot); (2) State n and number of independent experiments; (3) Use UpSet plot (Lex 2014, IEEE TVCG) for ≥4 sets, not Venn diagrams.

一、依資料類型選圖

資料類型推薦圖表不推薦
單組連續分佈直方圖+densitybar + SEM
多組比較(小樣本)點圖 + 95% CIbar + SEM
多組(大樣本)violin + boxplot, ridgepie chart
兩變量關係散點+平滑+r3D 散點
多批次組學heatmap (cluster), PCA瀑布圖
差異基因總覽volcanobar of top genes
≥4 集合交集UpSet plotVenn diagram
統合分析forest plot分散 bar

同一組資料 → 三種觀感

切換按鈕,觀察 bar+SEM、box plot、dot plot 對同一組資料的呈現差異。重點:bar+SEM 隱藏了 outlier 與雙峰,dot plot 全部攤開。

Toggle the buttons — see how bar+SEM, boxplot, and dot plot present the same data. Bar+SEM hides outliers and bimodality; dot plot shows it all.

兩組 n=20

二、SuperPlot 與 Volcano 範例

library(ggplot2); library(dplyr); library(ggrepel); library(viridis)

# 1. SuperPlot — 顏色標示生物重複
sp <- df %>% group_by(replicate, group) %>%
  summarise(rep_mean = mean(value), .groups="drop")

ggplot(df, aes(x=group, y=value, color=factor(replicate))) +
  geom_jitter(width=.15, alpha=.4, size=1.5) +
  geom_point(data=sp, aes(y=rep_mean), size=5, shape=95) +
  stat_summary(fun=mean, geom="crossbar", width=.4, color="black") +
  scale_color_viridis(discrete=TRUE, option="D") +
  theme_classic() + labs(color="Bio rep")

# 2. Volcano plot with labels
res_df$sig <- case_when(res_df$padj < .05 & abs(res_df$lfc) > 1 ~ "hit", TRUE ~ "ns")
ggplot(res_df, aes(lfc, -log10(padj), color=sig)) +
  geom_point(alpha=.5) +
  geom_text_repel(data=filter(res_df, sig=="hit"), aes(label=gene), max.overlaps=20) +
  geom_vline(xintercept=c(-1,1), lty=2) + geom_hline(yintercept=-log10(.05), lty=2)
import seaborn as sns, matplotlib.pyplot as plt

# 1. SuperPlot 風格
fig, ax = plt.subplots(figsize=(5,4))
sns.stripplot(data=df, x="group", y="value", hue="replicate",
              palette="viridis", jitter=.15, alpha=.4, ax=ax, size=4)
rep_mean = df.groupby(["replicate","group"])["value"].mean().reset_index()
sns.stripplot(data=rep_mean, x="group", y="value", hue="replicate",
              palette="viridis", marker="_", size=30, jitter=False, ax=ax, legend=False)
sns.pointplot(data=df, x="group", y="value", color="k", errorbar=("ci",95), ax=ax, markers="D")

# 2. Volcano
fig, ax = plt.subplots()
ax.scatter(res.lfc, -np.log10(res.padj), c="#ccc", s=8, alpha=.5)
hits = (res.padj < .05) & (res.lfc.abs() > 1)
ax.scatter(res.lfc[hits], -np.log10(res.padj[hits]), c="#3730a3", s=14)
ax.axhline(-np.log10(.05), ls="--", c="#888"); ax.axvline(1, ls="--", c="#888"); ax.axvline(-1, ls="--", c="#888")

三、視覺化的雷區

3D 圓餅 / 3D 長條

視角扭曲比例。Tufte 與所有現代視覺化教科書一致反對。

3D distorts proportions. Universally rejected by modern viz textbooks.

軸不從 0 開始

誇大微小差異。長條圖必須從 0 開始;點圖可截斷但必須明顯標示。

Exaggerates trivial differences. Bar charts must start at 0; dot plots may truncate but with clear indication.

紅綠 heatmap

對最常見的紅綠色盲不友善。改用 viridis、RdBu、Okabe-Ito。

Unfriendly to red-green colorblind viewers. Use viridis, RdBu, or Okabe-Ito.

* ** *** 不註明 p

現代期刊要求附 exact p。星號可保留為視覺指引,但 p 值必須在圖例或表格內。

Modern journals require exact p-values. Asterisks may stay as visual cues, but report exact p in legend or table.

🎯 章末小測驗

1. Weissgerber 2015 主要建議?

禁 ggplot2
展示原始點
必須 3D
一律 violin

2. ≥4 集合交集用?

Venn diagram
UpSet plot
Sankey diagram
Pie chart

3. 色盲友善調色板?

rainbow / jet
viridis / Okabe-Ito
red-green diverging
HSV uniform