etc5523-2020 / exercise2C

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

How to plot with date in order? #35

Open Lulu-Pi opened 4 years ago

Lulu-Pi commented 4 years ago

Here is the data frame count_date1, but the plots was not generated in order? how can I change the code? Date <- c('13-04-2015', '13-05-2015', '13-06-2015', '14-04-2015', '14-05-2015', '14-06-2015', '15-04-2015', '15-05-2015', '15-06-2015', '16-04-2015', '16-05-2015', '16-06-2015', '17-04-2015', '17-05-2015', '17-06-2015', '18-04-2015', '18-05-2015', '18-06-2015', '19-04-2015', '19-05-2015', '19-06-2015', '20-04-2015', '20-05-2015', '20-06-2015', '21-04-2015', '21-05-2015', '21-06-2015', '22-04-2015', '22-05-2015', '22-06-2015', '23-04-2015', '23-05-2015', '23-06-2015', '24-04-2015', '24-05-2015', '24-06-2015', '25-04-2015', '25-05-2015', '25-06-2015', '26-04-2015', '26-05-2015', '26-06-2015', '27-04-2015', '27-05-2015', '27-06-2015', '28-04-2015', '28-05-2015', '28-06-2015', '29-04-2015', '29-05-2015', '29-06-2015', '30-04-2015', '30-05-2015', '30-06-2015') freq <- c(24, 12, 32, 23, 15, 16, 12, 12, 34, 20, 16, 29, 21, 7, 32, 8, 14, 47, 9, 12, 29, 20, 15, 16, 12, 17, 12, 22, 14, 30, 23, 12, 190, 24, 7, 218, 16, 12, 98, 8, 27, 55, 25, 17, 39, 26, 26, 27, 22, 14, 51, 24, 9, 53) count_date1 <- data.frame(Date,freq)

`library(ggplot2) 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?`

image

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