I'm using ggpairs()
in the GGally
package. The pairs plot is of four continuous variables, and I gave another column, a factor with 2 levels, to a colour
argument which worked very nicely, both coloring the points as I expected and (bonus!) in the upper-diagonal part of the plot reporting the correlations by that factor level. My only problem is that the text reporting the correlations is too small.
Can I increase the size of the text reporting correlations in a ggpairs()
plot?
I tried giving a cex
argument, it seems to have no effect. I'm already using size
for yet another variable; it doesn't affect the text.
For a specific example:
require(GGally)
mtcars$cyl <- as.factor(mtcars$cyl)
ggpairs(mtcars, columns = c(1, 5), colour = "cyl")
For anyone finding their way to this thread in 2017 and beyond, this has changed slightly.
See schloerke's answer here: https://github.com/ggobi/ggally/issues/31
ie. to change the font size used in the correlations, use the upper parameter to the ggpairs function like so:
ggpairs(mtcars, columns = c(1, 5), colour = "cyl",
upper = list(continuous = wrap("cor", size = 9)))
You can also specify the correlation text size in the params. For your example, you could specify a correlation font size of 12 as follows:
require(GGally)
mtcars$cyl <- as.factor(mtcars$cyl)
ggpairs(mtcars, columns = c(1, 5), colour = "cyl", params=list(corSize=12))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With