1

The following code creates a correlation matrix visulization that is not very readable:

1) The text is too large and the numbers inside the cells are not readable
2) The ticks in the x and y axes do not offer information because they are too congested

Could you advise me how to deal with these problems:

The code is the following:

library(GGally)
library(ggplot2)
library(data.table)
library(ROSE)
library(dplyr)

#===================================================================================================================
# LOAD THE DATA
#===================================================================================================================

data(hacide)

train <- hacide.train

#=============================================================================================================
# FEATURE EXTRACTION
#=================================================================================================================

setDT(train)

train <- train %>% mutate(

  x11 = ifelse(x1 < -1.4, 1, 0),
  x12 = ifelse(((x1 >= -1.4) & (x1 < -0.74)), 1, 0),
  x13 = ifelse(((x1 >= -0.74) & (x1 < 1)), 1, 0),
  x14 = ifelse(x2 >= 1, 1, 0),
  x21 = ifelse(x2 < -1.4, 1, 0),
  x22 = ifelse(((x2 >= -1.4) & (x2 < -1)), 1, 0),
  x23 = ifelse(((x2 >= -1) & (x2 < 0.5)), 1, 0),
  x24 = ifelse(x2 >= 0.5, 1, 0),
  x3 = x1 ^ 2 - x2
)

#=========================================================================================================
# EXAMINE CORRELATIONS
#=========================================================================================================

ggpairs(train , 
        lower = list(continuous = wrap("points", color = "red", alpha = 0.5), 
                     combo = wrap("box", color = "orange", alpha = 0.3), 
                     discrete = wrap("facetbar", color = "yellow", alpha = 0.3) ), 
        diag = list(continuous = wrap("densityDiag",  color = "blue", alpha = 0.5) ))

The plot is the following:

enter image description here

4

0 回答 0