2017-05-12 21 views
-1

我使用ggpairs(如下圖)繪製一個圖,但它看起來很混亂。至於解決它,我已閱讀文檔,但沒有多大幫助。如何調節ggparis圖

[1]

我怎樣才能減少係數的字體大小?

第二,我想知道如何以更可讀的方式改善這個情節。也許這可以通過調整散點圖或標籤來完成? 如果有人有一個想法,請讓我知道什麼和如何做。

這裏是我爲這個情節寫的代碼。

ggpairs(wine_subset[sample.int(nrow(wine_subset), 1000), ], 
     upper = list(wrap(ggally_cor, size = 2))) 
+0

調整基本大小:'+ theme_bw(base_size = 20)' – Roland

回答

1

最簡單的解決方案是使保存文件的高度和寬度變大。這裏有些例子。請看看結果如何不同。

library(GGally) 
    library(data.table) 
    sample_data <- data.table(a = rnorm(1000)) 
    for(i in 2:12) sample_data[, letters[i] := rnorm(100) ] 
    head(sample_data) 
    g <- ggpairs(sample_data, 
      upper = list(wrap(ggally_cor, size = 2))) 
    ggsave("temp1.pdf", g, width = 6, height = 6) 
    ggsave("temp2.pdf", g, width = 9, height = 9) 
    ggsave("temp3.pdf", g, width = 12, height = 12) 
    ggsave("temp1.png", g, width = 6, height = 6) 
    ggsave("temp2.png", g, width = 9, height = 9) 
    ggsave("temp3.png", g, width = 12, height = 12)