Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change diagonal plots in ggpairs

Tags:

r

ggplot2

ggally

I'm not able to change the diagonal plots in a ggpair-plot. I would like to change their appearance in general and maybe starting by leaving them blank. This is how I think it should be:

ggpairs(data=df,
             columns=1:3,
             diag = list(discrete = "blank"),
             title="APD pool",
             mapping=ggplot2::aes(colour = Irradiated)
            ) 

but it ends with a density curve(?!) in the diagonal elements. Due to Robin's comment I tried it with

ggpairs(data=df,
             columns=1:3,
             diag = list(continous = "blank"),
             title="APD pool",
             mapping=ggplot2::aes(colour = Irradiated)
            ) 

but it doesn't change.

Plot

What am I doing wrong? Thank you!

Reference: https://rdrr.io/cran/GGally/man/ggpairs.html

like image 864
Ben Avatar asked Nov 24 '25 09:11

Ben


1 Answers

You spelled continuous wrongly. Your code spelt it "continous" instead.

When you use diag, you have to pass in a list that may only contain the variables continuous, discrete, and na. When you assign a value to continuous, it can only be exactly one of

  • 'densityDiag'
  • 'barDiag'
  • 'blankDiag'

So instead of diag = list(continous = "blank") you want to have diag = list(continuous = "blankDiag") instead. That would do the trick: enter image description here

like image 76
onlyphantom Avatar answered Nov 26 '25 22:11

onlyphantom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!