etc5523-2020 / exercise2C

For students to submit their reproducible example in the issue
0 stars 0 forks source link

Help - Overlapping labels on the x-axis! #16

Open mayunk264 opened 4 years ago

mayunk264 commented 4 years ago

Hi, I am attempting to draw a scatter plot. Unfortunately, the labels on the x-axis are overlapping each-other. This makes the plot hard to interpret. Does anyone have any ideas as to how I can format the x-axis labels to avoid the overlapping? Many thanks. I have included a reproducible example of my code below:

library(ggplot2)

Date <- c("13-04-2015","19-05-2015","19-06-2015","26-04-2015","26-05-2015","26-06-2015","27-04-2015","4/2/2015","4/3/2015","4/5/2015","4/6/2015","4/7/2015","5/5/2015","5/6/2015","5/7/2015","5/8/2015","6/9/2015")

freq <- c(24,12,29,8,27,55,25,27,15,6,13,25,14,14,15,15,23)

Count_date1 <- data.frame(Date,freq)

ggplot(Count_date1, aes(Date,freq)) + 
  geom_point() + 
  geom_line(aes(group=Date)) +
  xlab("Date") + 
  ylab("No. of Complaints")
#> geom_path: Each group consists of only one observation. Do you need to adjust
#> the group aesthetic?

Created on 2020-08-13 by the reprex package (v0.3.0)