0

I created a dataframe, DF.

date <- c("2018-06-25", "2018-06-25", "2018-06-26", "2018-06-26", "2018-06- 
27", "2018-06-27")

temperature <- c("15", "18", "16", "17", "14", "15")

DF <- data.frame(date, temperature)

I want to plot temperature over the different dates using ggplot.

How do I adapt my code below, so that the scale on the y-axis starts at 0.

ggplot(DF, aes(date, temperature))+geom_point() + ggtitle('Temperature plot') 

Link to temperature plot

Community
  • 1
  • 1
J Nkansa
  • 5
  • 3
  • @PoGibas The solution within that link, does not work for my problem – J Nkansa Jul 16 '18 at 17:06
  • 3
    I think the problem is that `temperature` is not numeric, thus you cant use the conventional `scale_xxx` or `xlim` functions. Try changing them to numeric. Refer [here](https://stackoverflow.com/a/29280280/2625032). After converting, you should be able to do `... + ylim(0, upper)` and it should work. __edit__: just tired it, confirmed working :thumbsup: – hello_world Jul 16 '18 at 17:12
  • @hello_world okay! That works for me too. Thanks! – J Nkansa Jul 16 '18 at 17:28

0 Answers0