Lillian Welsh
Lillian Welsh

Reputation: 39

How to format text size in ggpairs plot?

I have the ggplot2 and GGally package and library installed. When I run this code, the font in the diagonal is too large so that it's unreadable (see attached image).

ggpairs(hrdata, columns= c(1,8,19,29), title="Scatterplot Matrix", aes(color=EducationField))
   + scale_fill_manual(values=cbPalette)
   + scale_colour_manual(values=cbPalette)
   + theme_grey(base_size=8)

When I try to add upper=list(continuous=wrap('cor', size=8)), I get the error:

Error: unexpected ','

I am guessing it has something to do with 'cor', but I'm not sure what that represents or how to change it.

Upvotes: 0

Views: 323

Answers (1)

Lillian Welsh
Lillian Welsh

Reputation: 39

My problem was the title (should have been using ggtitle). I figured it out trying to get a reproducible example with Iris.

ggpairs(iris, aes(color=Species), upper= list(continuous=wrap('cor', size=3)))+ ggtitle("Scatterplot Matrix")+ scale_fill_manual(values=cbPalette)+ scale_colour_manual(values=cbPalette)+ theme_grey(base_size=8)

Upvotes: 0

Related Questions