如何绘制一个环绕并覆盖两行的文本,使其不覆盖下一行?这是一个例子:
library(gplots)
a <- data.frame(a = c(1,2,3), b = c(4,5,6))
colnames(a)[1] <- "wrap\ntext"
textplot(a)
很容易看出,text
标题中的单词涵盖了第一 (1)。
玩弄rmar
和cmar
?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)
我一定要回来解决这个问题。我认为最好的解决方案是插入一个空行并删除第一行名称。当然,如果您希望它进一步扩展一行,请添加 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)