在'R'中的'gplots'中,我们如何在'heatmap.2'函数中调整x标签标记的位置?

在'R'中的'gplots'中,我们如何在'heatmap.2'函数中调整x标签标记的位置?,r,gplots,R,Gplots,我试图复制第4页上的一个图: 其可复制代码为: require(devtools) install_git("https://github.com/marchion/git.switchBox", subdir="switchBox") require(switchBox) require(gplots) data(trainingData) classifier <- SWAP.KTSP.Train(matTraining, trainingGroup) kappa <-

我试图复制第4页上的一个图:

其可复制代码为:

require(devtools)
install_git("https://github.com/marchion/git.switchBox", subdir="switchBox")
require(switchBox)
require(gplots)
data(trainingData)    
classifier <- SWAP.KTSP.Train(matTraining, trainingGroup)
kappa <- SWAP.KTSP.Statistics(matTraining, classifier)
mat <- t(1*kappa$comparisons)
rownames(mat) <- gsub(">", "\n more express than\n", rownames(mat))

heatmap.2(mat,
scale="none", Rowv=F, Colv=F, dendrogram="none",
trace="none", key=FALSE,
col=c("lightsteelblue2", "pink3"),
labCol=toupper(paste(trainingGroup, "Prognosis")),
sepwidth=c(0.075,0.075), sepcolor="black",
rowsep=1:ncol(kappa$comparisons),
colsep=1:nrow(kappa$comparisons),
lmat=rbind( c(0, 3), c(2, 1), c(0, 4) ), lhei=c(0.1, 5, 0.5), lwid=c(0.15, 5),
mar=c(7.5, 12), cexRow=0.85, cexCol=0.9)
require(devtools)
安装_git(“https://github.com/marchion/git.switchBox,subdir=“开关盒”)
需要(开关箱)
需要(gplots)
数据(培训数据)

分类器您必须指定参数
adjCol
c(1,0.5)
)将给出所需的结果(
c(1,0)
将其向左移动,
c(1,1)
将其向右移动更多)

代码(使用OPs提供的包和数据):

结果:

heatmap.2(
  mat,
  adjCol = c(1, 0.5), 
  scale = "none", Rowv = FALSE, Colv = FALSE, dendrogram = "none",
  trace = "none", key = FALSE,
  col = c("lightsteelblue2", "pink3"),
  labCol = toupper(paste(trainingGroup, "Prognosis")),
  sepwidth = c(0.075,0.075), sepcolor = "black",
  rowsep = 1:ncol(kappa$comparisons),
  colsep = 1:nrow(kappa$comparisons),
  lmat = rbind( c(0, 3), c(2, 1), c(0, 4) ),
  lhei = c(0.1, 5, 0.5), lwid = c(0.15, 5),
  mar = c(7.5, 12), cexRow = 0.85, cexCol = 0.9,
)