问题
I have been experimenting with ggpairs (from GGally) as an exploratory tool. I am running into issues with axis tick labels overwriting each other. If this was straight ggplot2, I would put them on a 45 or 90 degree angle and all would be well, but I cannot figure out how to do this for ggpairs. Poking around on the internet leaves me with the feeling that it may be something one can do with wrap, but no idea how to proceed. Can anyone help?
Some code that has an ugly result:
library(dplyr)
library(ggplot2)
library(GGally)
library(MASS)
cars <- dplyr::select(Cars93, Type, Price, MPG.city, MPG.highway,
EngineSize, Origin)
ggpairs(cars)
I get ugly ggpairs with really messy labels in the bottom left corner
Thank you for looking.
回答1:
Since Brian didn't post his comment as an answer, I will. Change the last line to
ggpairs(cars) +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
and it is all legible.
来源:https://stackoverflow.com/questions/46864196/ggpairs-rotate-axis-label