【问题标题】:How to change the margins of a correlation matrix plot?如何更改相关矩阵图的边距?
【发布时间】:2016-12-26 01:16:30
【问题描述】:

我找不到任何选项来扩大corrplot.mixedcorrplot 包中生成的绘图的边距。任何建议将不胜感激!

library(corrplot) 
cor_matrix <- structure(c(1, 0.31596392056465, -0.120092224085334, -0.345097115278159, 
                          0.31596392056465, 1, 0.158912865564527, -0.606426850726639, -0.120092224085334, 
                          0.158912865564527, 1, -0.134795548155303, -0.345097115278159, 
                          -0.606426850726639, -0.134795548155303, 1), .Dim = c(4L, 4L), 
                        .Dimnames = list(NULL, c("var_1", "var_2", "var_3", "var_4")))

corrplot.mixed(cor_matrix, order = "AOE", upper = "ellipse", lower = "number", 
               tl.cex = 2, cl.cex = 2, number.cex = 2)

【问题讨论】:

  • 我建议查看包函数本身 fix(corrplot.mixed) 并在那里编辑边距。
  • 扩大边距是什么意思?你的意思是要改变是 re par(oma=rep(5,4)) 还是 ..?
  • 增加图形窗口/图形输出设备的大小:我在屏幕上看到所有图例标签,无需调整。所以试试,例如,pdf("test.pdf", height=10, width=10) ; corrplot(...) ; dev.pff()
  • 看看?png?tiff,它们有不同的高度/宽度单位
  • 我发现更改图形窗口/输出设备的纵横比会有所帮助。当我在屏幕上显示时,一个 16:9 横向大小的窗口会切断顶部标签。但是将“缩放窗口”(R-Studio)的大小调整为方形,甚至纵向,解决了这个问题。在前面的 cmets 中,相同的解决方法适用于 PDF 和 PNG。

标签: r plot margin correlation r-corrplot


【解决方案1】:

为未来的读者回答我自己的问题

library(corrplot) 
library(scico)

col4 <- scico(100, palette = 'vik')
filetag <- "corrplot_result.png"

png(filetag, height = 800, width = 800)

  corrplot.mixed(cor_matrix, order = "AOE", upper = "ellipse", lower = "number", 
                 upper.col = col4, lower.col = col4,
                 tl.cex = 2, cl.cex = 2, number.cex = 2)
dev.off()

【讨论】:

    猜你喜欢
    • 2019-04-10
    • 2014-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多