etc5523-2020 / exercise2C

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

How to adjust the dates on the x axis of this plot so that it is easily read? #5

Open jthoma48 opened 4 years ago

jthoma48 commented 4 years ago

Hi, I'm trying to plot frequency values to specific dates. I have placed the date as my x-axis and the frequency value as my y-axis. However, upon generating the plot, the dates are squished together and I cannot easily read the dates. I would like to fix this problem so that the plot shows the dates properly. Below you can see the dataset I used, the code I wrote to generate the plot, the error messages, the R packages I am using and their versions and my hardware information. Thank you for your help!

date freq      
28-06-2015 27      
29-04-2015 22      
29-05-2015 14      
29-06-2015 51      
30-04-2015 24      
30-05-2015 9      
30-06-2015 53      
31-05-2015 10      
4/1/2015 18      
4/10/2015 21

Screen Shot 2020-08-12 at 7 51 30 PM

ggplot(count_date1, aes(date,freq)) + 
    geom_point() + 
    geom_line(aes(group=date)) +
    xlab("Date") + 
    ylab("No. of Complaints")
#> Error in ggplot(count_date1, aes(date, freq)): could not find function "ggplot"

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

Session info ``` r sessionInfo() #> R version 4.0.2 (2020-06-22) #> Platform: x86_64-apple-darwin17.0 (64-bit) #> Running under: macOS Mojave 10.14.3 #> #> Matrix products: default #> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib #> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib #> #> locale: #> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> loaded via a namespace (and not attached): #> [1] compiler_4.0.2 magrittr_1.5 tools_4.0.2 htmltools_0.5.0 #> [5] yaml_2.2.1 stringi_1.4.6 rmarkdown_2.3 highr_0.8 #> [9] knitr_1.29 stringr_1.4.0 xfun_0.16 digest_0.6.25 #> [13] rlang_0.4.7 evaluate_0.14 ```