92视频呻吟久久Alr,日韩亚洲视频一区,青青操日本逼碰碰,亚洲欧美日韩中文一区,国产偷自拍,精品一区在线,亚洲精品在线久久,九九国产精品人妻,天堂影视麻豆


  • 免費(fèi)服務(wù)熱線
  • 400-065-6886
  • 電話:86(0)512-6295 9990
  • 傳真:86(0)512-6295 9995
新聞中心

【零基礎(chǔ)學(xué)繪圖】之氣泡圖繪制(六)

發(fā)稿時間:2020-05-29來源:天昊生物





氣泡圖是R語音中的基礎(chǔ)繪圖,可用于展示三個變量之間的關(guān)系的圖表,將一個變量放在x軸,另一個變量放在y軸,而第三個變量則用氣泡的大小來表示。通常用于展示差異基因的表達(dá)情況、轉(zhuǎn)錄因子的分析、物種豐度數(shù)據(jù)的可視化、富集分析展示等。這里我們介紹2種繪制氣泡圖的方法:ggpubr繪制氣泡圖 和 ggplot 繪制氣泡圖 。



ggpubr繪制氣泡圖

1. 加載ggpubr包
In [1]:
  • library(ggpubr)

2. 數(shù)據(jù)讀取由于表頭是數(shù)字,需要添加參數(shù)check.names = FIn [2]:
  • df = read.table('phylum_taxon_abundance.xls',header = T,row.names = 1,check.names = F)
  • head(df)
Out[2]:
  • 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
  • Proteobacteria 126573 92545 83038 75739 103697 116154 73868 76555 47648 61165 90984 86653 111958 95141 92972 102300
  • Actinobacteria 12759 10186 50860 32437 34212 21024 64078 52398 46109 38587 46147 46310 46780 50249 32803 29345
  • Bacteroidetes 18428 25557 16559 22848 7046 23059 4974 8066 4984 15941 14064 12966 10931 5047 14100 27364
  • Acidobacteria 16566 26529 6636 16079 7563 10637 8352 11404 11755 7008 8292 9372 6405 5773 10853 6738
  • Chloroflexi 6665 11038 12520 20040 22476 4146 23314 26628 32961 30103 14238 11799 9819 15672 7421 6116
  • Firmicutes  6033  13830  21344  3293  18031  10253  12822  5480  35773  6208  13005  20341  7953  21295  19200  12794

3. 氣泡圖繪制3.1 繪制不帶參數(shù)的氣泡圖In [3]:
  • ggballoonplot(df)
Out[3]:

3.2 添加和填充顏色In [4]:
  • ggballoonplot(df, color = "red", fill = "blue")
Out[4]:


3.3 按照值的大小填充顏色,并制定氣泡圖形狀In [5]:
  • ggballoonplot(df, fill = "value", shape =21 ,) + gradient_fill(c("blue", "white", "red"))
Out[5]:


3.4 填充數(shù)值show.label =F 默認(rèn)不填充數(shù)值, show.label =T 填充數(shù)值選擇size參數(shù)固定圖形大小In [6]:
  • ggballoonplot(df, fill = "value", color = "lightgray",size = 3, show.label =F)+ gradient_fill(c("blue", "white", "red"))
Out[6]:



ggplot2繪制氣泡圖


1. 加載ggplot2包In [7]:
  • library(ggplot2)

2. 數(shù)據(jù)預(yù)處理stack是堆棧的意思,默認(rèn)按列堆數(shù)據(jù)In [8]:
  • data = stack(df)
  • colnames(data) = c('Abundance','sample')
  • head(data)
Out[8]:
  • Abundance sample
  • 126573 1
  • 12759 1
  • 18428 1
  • 16566 1
  • 6665 1
  • 6033 1
In [9]:
  • data$phylum = rep(rownames(df), times = ncol(df))
  • head(data)
Out[9]:
  • Abundance sample phylum
  • 126573 1 Proteobacteria
  • 12759 1 Actinobacteria
  • 18428 1 Bacteroidetes
  • 16566 1 Acidobacteria
  • 6665 1 Chloroflexi
  • 6033  1  Firmicutes

添加分組信息,本次分析將16個樣品分為2組,組名分別未A、BIn [10]:
  • colnames(df)

Out[10]:

  • '1' '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15' '16'
In [11]:
  • length(colnames(df))
Out[11]:
  • 16
In [12]:
  • rownames(df)
Out[12]:
  • 'Proteobacteria' 'Actinobacteria' 'Bacteroidetes' 'Acidobacteria' 'Chloroflexi' 'Firmicutes' 'Verrucomicrobia' 'Planctomycetes' 'Gemmatimonadetes' 'Candidatus_Saccharibacteria' 'Thaumarchaeota' 'Armatimonadetes' 'Euryarchaeota' 'candidate_division_WPS-1' 'Cyanobacteria/Chloroplast' 'Chlamydiae' 'Nitrospirae' 'Ignavibacteriae' 'Latescibacteria' 'candidate_division_WPS-2' 'Microgenomates' 'Elusimicrobia' 'Spirochaetes' 'Aminicenantes' 'Woesearchaeota'
In [13]:
  • length(rownames(df))
Out[13]:
  • 25
In [14]:
  • group = rep(c('A','B'),each = 25*16/2)
  • length(group)
Out[14]:
  • 400
In [15]:
  • data$group = group
In [16]:
  • head(data)
Out[16]:
  • Abundance sample phylum group
  • 126573 1 Proteobacteria A
  • 12759 1  Actinobacteria A
  • 18428 1 Bacteroidetes A
  • 16566 1 Acidobacteria A
  • 6665 1 Chloroflexi A
  • 6033 1 Firmicutes A

3. 氣泡圖繪制

In [16]:

  • ggplot(data, aes(x = sample, y = phylum, size = Abundance, colour = group)) + geom_point() +
  • theme_bw() +scale_size(range = c(0,6)) + labs(x = "Sample", y = "")

Out[17]:


往期相關(guān)鏈接:

1、R基礎(chǔ)篇

excel不熟練怎么辦,R來幫您(一)數(shù)據(jù)分類匯總;如何使用Rstudio練習(xí)R基礎(chǔ)教程;
R相關(guān)軟件及R包安裝;【零基礎(chǔ)學(xué)繪圖】之繪制venn圖(五);
【零基礎(chǔ)學(xué)繪圖】之繪制barplot柱狀圖圖(四);
【零基礎(chǔ)學(xué)繪圖】之繪制heatmap圖(三);【零基礎(chǔ)學(xué)繪圖】之繪制PCA圖(二);
【零基礎(chǔ)學(xué)繪圖】之a(chǎn)lpha指數(shù)箱體圖繪制(一);

2、R進(jìn)階

【繪圖進(jìn)階】之交互式可刪減分組和顯示樣品名的PCA 圖(三);

【繪圖進(jìn)階】之繪制PCA biplot圖(二)

【進(jìn)階篇繪圖】之帶P值的箱體圖、小提琴圖繪制(一)

3、數(shù)據(jù)提交

3分鐘學(xué)會微生物多樣性云平臺數(shù)據(jù)分析;

3分鐘學(xué)會CHIP-seq類實(shí)驗(yàn)測序數(shù)據(jù)可視化 —IGV的使用手冊

10分鐘搞定多樣性數(shù)據(jù)提交,最快半天內(nèi)獲取登錄號,史上最全的多樣性原始數(shù)據(jù)提交教程;

20分鐘搞定GEO上傳,史上最簡單、最詳細(xì)的GEO數(shù)據(jù)上傳攻略

4、表達(dá)譜分析

表達(dá)譜分析(二)通路富集分析和基因互作網(wǎng)絡(luò)圖繪制;如何對GEO數(shù)據(jù)進(jìn)行差異分析;

5、醫(yī)學(xué)數(shù)據(jù)分析

KING: 樣本親緣關(guān)系鑒定工具;【W(wǎng)GS服務(wù)升級】人工智能軟件SpliceAI助力解讀罕見和未確診疾病中的非編碼突變;隱性疾病trio家系別忽視單親二倍體現(xiàn)象——天昊數(shù)據(jù)分析助力臨床疾病診斷新添UPD(單親二倍體)可視化分析工具;【昊工具】Oh My God! 太好用了吧!疾病或表型的關(guān)鍵基因查詢數(shù)據(jù)庫,我不允許你不知道Phenolyzer
Copyright ? 2012-2025 天昊基因科技(蘇州)有限公司    All Rights Reserved    蘇ICP備17064027號-1
聂荣县| 绥芬河市| 寿阳县| 岗巴县| 卢氏县| 平泉县| 上犹县| 清新县| 南京市| 丰宁| 乳山市| 祁阳县| 拜城县| 苍山县| 广河县| 元江| 刚察县| 凤山县| 哈密市| 石棉县| 乌兰察布市| 商丘市| 安康市| 常熟市| 双柏县| 故城县| 壶关县| 遂昌县| 荣成市| 平陆县| 循化| 江西省| 商丘市| 舟曲县| 通河县| 平远县| 大竹县| 阳泉市| 梅州市| 茂名市| 郁南县|