0

I am using the following code to generate a pairplot in R

require(GGally)

data %>%

  GGally::ggscatmat(columns = 3:13 ,color = "Type", corMethod = "spearman") +
  ggsci::scale_color_jco()+
  ggpubr::theme_pubclean()+
  theme(strip.background = element_rect(fill = "grey90"), 
        axis.text = element_text(size = 8), 
        legend.position = "right",
        legend.key = element_blank())

This code works totally fine when I use 9 columns of the dataset. However, when the number of columns exceeds 9, like 10 or 11 or more, it rotates the last two columns, overlap on y-axis and generates a plot like this

Pairplot in R

I tried changing screen size, exported image size and font size but nothing works!

Please see that the scatter plot overlapping in the last two columns should have been plotted as rows at the bottom.

The dataset can be accessed from my dropbox at following link

https://www.dropbox.com/s/hoks7fw2k27pr7r/data.xlsx?dl=0

  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. I'm not sure I see the problem you are describing in the image provided. Can you highlight the area that's affected? – MrFlick Jun 25 '21 at 05:33
  • Thanks Flick! I have update the post and provided a link to the dataset in my dropbox. In the attached figure, please see that the the last two column on the right with labels PC and TSS are overlapping with the text below. Instead, they should have been plotted at the bottom most lines which are empty here. – Sajid Aqeel Jun 25 '21 at 06:58

0 Answers0