Correlation matrix plot with ggplot2

前端 未结 2 1377
無奈伤痛
無奈伤痛 2020-12-31 15:31

I want to create a correlation matrix plot, i.e. a plot where each variable is plotted in a scatterplot against each other variable like with pairs() or s

相关标签:
2条回答
  • 2020-12-31 16:21
    library(GGally)
    
    set.seed(42)
    d = data.frame(x1=rnorm(100),
                   x2=rnorm(100),
                   x3=rnorm(100),
                   x4=rnorm(100),
                   x5=rnorm(100))
    
    # estimated density in diagonal
    ggpairs(d)
    

    enter image description here

    # blank
    ggpairs(d, diag = list("continuous"="blank")
    

    enter image description here

    0 讨论(0)
  • 2020-12-31 16:26

    Using PerformanceAnalytics library :

    library("PerformanceAnalytics")
    chart.Correlation(df, histogram = T, pch= 19)
    

    0 讨论(0)
提交回复
热议问题