1

如何绘制一个环绕并覆盖两行的文本,使其不覆盖下一行?这是一个例子:

library(gplots)

a <- data.frame(a = c(1,2,3), b = c(4,5,6))
colnames(a)[1] <- "wrap\ntext"
textplot(a)

示例图像错误

很容易看出,text标题中的单词涵盖了第一 (1)。

4

2 回答 2

2

玩弄rmarcmar

?textplot: rmar, cmar:行或列之间的空间,以字母“M”大小的分数表示。

library(gplots)

a <- data.frame(a = c(1,2,3), b = c(4,5,6))
colnames(a)[1] <- "wrap\ntext"
textplot(a, cmar = 2, rmar = 2)

在此处输入图像描述

于 2014-03-21T20:10:29.110 回答
0

我一定要回来解决这个问题。我认为最好的解决方案是插入一个空行并删除第一行名称。当然,如果您希望它进一步扩展一行,请添加 2 个空行,依此类推

library(gplots)

a <- data.frame(a = c(1,2,3), b = c(4,5,6))
colnames(a)[1] <- "wrap\ntext"
textplot(a)

## And here is the solution

a <- rbind(c("", ""), a)  ## Insert empty row
rownames(a)<- c("", 1:(dim(a)[1]-1)) ## delete first row name and name other indices
textplot(a)

示例图像错误

于 2014-04-22T21:15:34.747 回答