Making a Visual Correlation Matrix in R

The R-Code provided below is the brief introduction into how to create an aesthetically pleasing visual correlation matrix with ggplot2 and GGally (Code: R-Code). If you have any questions about the R-Code please email me!

# Written By Ian A. Silver (Email = silveria@rowan.edu)
# Written on 11/16/2020
## Have Fun !

library(ggpubr)
library(ggplot2)
library(extrafont)
library(GGally)
library(MASS)

# Simulating Data ####
CM<-matrix(c(1,.50,.10,.10,.10,.10,
             .50,1,.25,.25,.25,.25,
             .10,.25,1,.25,.25,.25,
             .10,.25,.25,1,.25,.25,
             .10,.25,.25,.25,1,.25,
             .10,.25,.25,.25,.25,1), nrow = 6)

set.seed(56)
DF<-data.frame(mvrnorm(n = 1000, mu = rep(0, 6), Sigma = CM, empirical = TRUE))



ggpairs(DF, # create a correlation matrix with the dataframe
        upper = list(continuous = wrap("cor", colour = "black", size = 9,family="Times New Roman")))+ # make the text in plot Larger, Black, and Times New Roman
        ggtitle("Correlation Matrix")+ # Title of Graph
        theme(legend.key = element_blank(), # My personal theme
        line = element_line(colour = "black", size = 1), 
        axis.line = element_line(colour = "black"), 
        panel.border= element_blank(), 
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(), 
        panel.background = element_blank(),
        title = element_text(family="Times New Roman", size= 24),
        axis.title.x = element_text(family="Times New Roman",colour = "Black", margin = margin(t = 20, r = 0, b = 0, l = 0), size = 12),
        axis.title.y = element_text(family="Times New Roman",colour = "Black", margin = margin(t = 0, r = 20, b = 0, l = 0), size = 12), 
        axis.text= element_text(family="Times New Roman", size= 12, color = "Black"), 
        text= element_text(family="Times New Roman", size= 12), 
        plot.margin = margin(t = 2, r = 2, b = 2, l = 2, unit = "cm"))