5

I need to use ggpairs() from the GGally plugin in R. I want to look at the correlation between 1 of the variables with the other 24 variables in this dataset and am required to use ggpairs().

How can I either break it up into several plots or otherwise make the resulting plot more viewable? At the moment, there are so many plots generated that it is impossible to see anything.

user1713336
  • 131
  • 5
  • 14

1 Answers1

4

Without looking at a toy dataset, I can think of a few things you can do. You can specify 4 columns in the ggpairs() function 6 times. It might look something like this:

yourplot <- ggpairs(yourmodel, columns = c("column1", "column2", "column3", "column4"),
columnLabels = c("column1", "column2", "column3", "column4"))

Now repeat this process 6 times and you've got your 24 variables plotted seprately.

Examples taken from here if you want to run it through with a dataset yourself.

Spencer Castro
  • 1,345
  • 1
  • 9
  • 21
  • 2
    I was also thinking along these lines but ran into an issue. Say that my variable of interest is in "column4". If I plot the variables separately this 4th column can only be seen in comparison with columns 1-3 (when I still want to see it compared to all the other columns as well). – user1713336 Jan 06 '18 at 02:39
  • 1
    Ok, if your column of interest is column 4, then can you specify column 4 every time and apply it to 3 other variables 8 times (the last plot will only have 2 comparison variables). So you'll make 8 plots and each one of them will have column 4 in them. – Spencer Castro Jan 06 '18 at 02:57