Overlapping axis labels in R [duplicate]

我是研究僧i 提交于 2019-11-30 13:07:25

问题


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?


回答1:


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

See: http://docs.ggplot2.org/current/scale_discrete.html



来源:https://stackoverflow.com/questions/19567986/overlapping-axis-labels-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!