网站建设合同模板91075,彩票网站开发.极云,wordpress副标题的作用,企业简介ppt范文大全SCI#xff0c;CCF#xff0c;EI及核心期刊绘图宝典#xff0c;爆款持续更新#xff0c;助力科研#xff01;
本期分享#xff1a;
【SCI绘图】【热力图系列2 R】多特征相关性分析热力图指定聚类 R 1.环境准备
library(gplots)
library(RColorBrewer)2.数据读取
###…SCICCFEI及核心期刊绘图宝典爆款持续更新助力科研
本期分享
【SCI绘图】【热力图系列2 R】多特征相关性分析热力图指定聚类 R 1.环境准备
library(gplots)
library(RColorBrewer)2.数据读取
#########################################################
### reading in data and transform it to matrix format
#########################################################data - read.csv(dataset.csv, comment.char#)
rnames - data[,1] # assign labels in column 1 to rnames
mat_data - data.matrix(data[,2:ncol(data)]) # transform column 2-5 into a matrix
rownames(mat_data) - rnames # assign row names
3.绘图展示
#########################################################
### customizing and plotting heatmap
########################################################## creates a own color palette from red to green
my_palette - colorRampPalette(c(red, yellow, green))(n 299)# creates a 5 x 5 inch image
png(h3_categorizing.png,width 5*300, # 5 x 300 pixelsheight 5*300,res 300, # 300 pixels per inchpointsize 8) # smaller font sizeheatmap.2(mat_data,cellnote mat_data, # same data set for cell labelsRowSideColors c( # grouping row-variables into differentrep(gray, 3), # categories, Measurement 1-3: greenrep(blue, 3), # Measurement 4-6: bluerep(black, 4)), # Measurement 7-10: redmain Categories, # heat map titlenotecolblack, # change font color of cell labels to blackdensity.infonone, # turns off density plot inside color legendtracenone, # turns off trace lines inside the heat mapmargins c(12,9), # widens margins around plotcolmy_palette, # use on color palette defined earlier dendrogramrow, # only draw a row dendrogramColvNA) # turn off column clustering# adding a color legend for the categories
par(lend 1) # square line ends for the color legend
legend(topright, # location of the legend on the heatmap plotlegend c(category1, category2, category3), # category labelscol c(gray, blue, black), # color keylty 1, # line stylelwd 10, # line width)dev.off()