R中的重叠轴标签 [英] Overlapping axis labels in R

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

问题描述

我有一个问题,我有重叠的轴标签,似乎无法得到解决方案来解决这个问题。

I have an issue where I have overlapping axis labels and can't seem to get a solution to fix this.

p <- ggplot(data=Data,aes(x=Indicator,y=Numeric,group=Expenditure_group,shape=Expenditure_group,colour=Expenditure_group))+geom_point()+geom_line()

有没有办法解决这个问题,没有重叠?

Is there a way to fix this so that there are no overlaps?

推荐答案

您可以通过自动缩写
$ b中的标签来调整x轴$ b

You can tune a bit your x axis either by automatically abbreviating labels as in

p + scale_x_discrete(labels = abbreviate)

或者您可以自己提供缩写标签,如

or you can provide abbreviated labels yourself as in

p + scale_x_discrete(labels = c("Congenital Rubella" = "C. Rub.", ..., "Total tetanus" = "T. tet.", "Yellow fever" = "Y. fever")

请参阅: http://docs.ggplot2.org/current /scale_discrete.html

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

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