Reputation: 433
I have a dataset with relatively large column names. When displaying the ggpairs, they fall outside of the limit, and one cannot read the each plot labels. I have tried theme(axis.text = element_text(size=8))
inside the ggpairs()
command, but it doesn't work. Can you please help me with that?
Upvotes: 3
Views: 3590
Reputation: 121
To change the column and row labels in the grey boxes of facet_wrap() and ggpairs(), you can specify the size of the strip.text as follows:
pm + theme(strip.text.x = element_text(size = 5),
strip.text.y = element_text(size = 5))
Is this what you meant?
Upvotes: 3
Reputation: 41225
You should add the theme
and check if you size is high enough like this:
library(GGally)
data(diamonds, package="ggplot2")
diamonds.samp <- diamonds[sample(1:dim(diamonds)[1], 1000), ]
pm <- ggpairs(
diamonds.samp[, 1:5],
mapping = ggplot2::aes(color = cut),
upper = list(continuous = wrap("density", alpha = 0.5), combo = "box_no_facet"),
lower = list(continuous = wrap("points", alpha = 0.3), combo = wrap("dot_no_facet", alpha = 0.4)),
title = "Diamonds"
)
pm
pm + theme(axis.text = element_text(size = 20))
Created on 2022-08-10 by the reprex package (v2.0.1)
Upvotes: 3