Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlapping axis labels in R [duplicate]

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

enter image description here

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?

like image 948
coder_007 Avatar asked Oct 24 '13 13:10

coder_007


1 Answers

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

like image 70
ƒacu.- Avatar answered Nov 05 '22 03:11

ƒacu.-