R corrplot产生空图

时间:2014-12-04 17:45:32

标签: r plot r-corrplot

我有一个带有~750k元素的矩阵,我想用corrplot绘制。它绘制好没有错误,但它产生的图是空的,只有颜色标度。当使用commnad-line R时,它会显示" Quartz 2"窗口,但几秒后消失。是什么赋予了?

library("corrplot")
mat <- matrix(data = rexp(200, rate = 10), nrow = 800, ncol = 800)
col1 <- colorRampPalette(c("#00007f", "#00007f", "#00007f", "#00007f", "blue", "cyan", "#00cc00", "yellow", "#FF7F00", "red"), interpolate = "linear", alpha = TRUE) 
corrplot(splotMat, is.corr = FALSE, method = "color", tl.pos = "n", col = col1(100), cl.lim = c(-0.14, 1))

1 个答案:

答案 0 :(得分:1)

我认为问题不在于代码与绘图窗口的分辨率(即子像素绘图)一样多。我玩的是尺寸低于500x500的矩阵,它在我的笔记本电脑屏幕上显示得很好。在550左右,我失去了它(空白,如你所见)。当我将窗户移动到更大的显示器时,我能够绘制到800(尽管它确实需要一段时间)。

要查看它是否以更精细的分辨率提供渲染,我将其转储为PDF并放大:

## your data
library("corrplot")
mat <- matrix(data = rexp(200, rate = 10), nrow = 800, ncol = 800)
col1 <- colorRampPalette(c("#00007f", "#00007f", "#00007f", "#00007f", "blue",
                           "cyan", "#00cc00", "yellow", "#FF7F00", "red"),
                         interpolate = "linear", alpha = TRUE) 
## demonstration
pdf("foo.pdf", width = 20, height = 20)
corrplot(mat, is.corr = FALSE, method = "color",
         tl.pos = "n", col = col1(100), cl.lim = c(-0.14, 1))
dev.off()

文件相当大(~8MB)但您可以放大并查看单个单元格颜色(尽管它们可能很暗)。