[英]How to construct a grouped boxplot including 6 groups ( expression levels of 6 different genes) and 2 subgroups (Control & Cancer) in R using ggplot2
數據類似於如下所示。 如果有人可以在這種情況下幫助我,將不勝感激。
基因對照表達 癌症表達 BAX 12 34 BID 18 45 PMAIP1 10 24
該圖應在 x 軸上描繪所有候選基因,在 y 軸上描繪每個基因按腫瘤和正常分組的表達水平。 該示例已顯示。 在此處輸入圖像描述
如果您的數據確實具有與我的示例相同的格式,則此代碼應該可以工作:
library(tidyverse)
data <- data.frame(value = rnorm(120, mean = 5),
genes = rep(c("A", "B", "C", "D", "E", "F"), each = 20),
condition = rep(c("tumor", "normal"), times = 60))
data %>%
ggplot(aes(x = genes, y = value, fill = condition))+
geom_boxplot()+
theme_classic()
使用reprex v2.0.2創建於 2022-09-13
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.