运行热图R代码时出现X11错误

时间:2011-11-29 19:38:48

标签: r fonts x11 heatmap

当我运行命令时:

R-2.14.0/bin/R --slave -f heatmap.R

我收到以下错误:

Error in axis(1, 1L:nc, labels = labCol, las = 2, line = -0.5, tick = 0,  :
  X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 9 could not be loaded
Calls: heatmap -> axis
In addition: There were 19 warnings (use warnings() to see them)
Execution halted

以下是heatmap.R中包含的代码:

require(graphics); require(grDevices)
x  <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start=0, end=.3)
cc <- rainbow(ncol(x), start=0, end=.3)
png("heatmap.png", height=1500, width=1500)
heatmap(x, col = cm.colors(256), scale="column",
RowSideColors = rc, ColSideColors = cc, margins=c(5,10),
xlab = "specification variables", ylab= "Car Models")
dev.off()

如何避免X11错误?需要更改哪些配置?

2 个答案:

答案 0 :(得分:0)

我通过重新安装新的R-base来修复错误

答案 1 :(得分:0)

我有类似的错误:

Error in mtext(plotHeader, cex = 1.6, line = 0.5) :
X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 19 could
Execution halted
通过更改"cex=1"的尺寸参数

来修复

尝试在您的情节中引入并选择合适的cex参数