ggpairs旋转轴标签 [英] ggpairs rotate axis label

查看:54
本文介绍了ggpairs旋转轴标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用ggpairs(来自GGally)作为探索工具.我遇到了轴刻度标签相互覆盖的问题.如果这是直接的ggplot2,我会将它们置于45度或90度角,一切都会好起来,但是我无法弄清楚如何对ggpairs执行此操作.在互联网上闲逛使我感到可能是包裹可以做的事情,但不知道如何进行.有人可以帮忙吗?

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?

一些结果很丑的代码:

library(dplyr)
library(ggplot2)
library(GGally)
library(MASS)
cars <- dplyr::select(Cars93, Type, Price, MPG.city, MPG.highway, 
                  EngineSize, Origin)
ggpairs(cars)

我在左下角得到了带有真正凌乱标签的丑陋的ggpairs

I get ugly ggpairs with really messy labels in the bottom left corner

谢谢您的光临.

推荐答案

由于Brian没有将他的评论发布为答案,所以我会的.将最后一行更改为

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))

一切都清晰可见.

这篇关于ggpairs旋转轴标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆