I have this dataframe (df):
day time value
20011101 93000 1.00000000
20011102 93000 1.00000000
20011105 93000 1.00000000
20011101 100000 0.81958763
20011102 100000 0.95412844
20011105 100000 0.27610209
20011101 103000 0.27835052
20011102 103000 0.32415902
20011105 103000 0.77958237
20011101 110000 0.23711340
Example here: https://www.dropbox.com/s/y7mtcay6ke9ydnm/sample.txt
Using ggplot, I am trying to get a line for each day, where the x axis is time = so I wrote in R:
ggplot(df, aes(x=time, y=value, colour=day)) + geom_line()
Unfortunately, this is what I got. I did not expect such a plot.

And this is an Excel graph. This is the one I'm looking for. A different line for each day:

I don’t know how to say R to join the points from the same day ... What is wrong? What am I missing?
One more thing: since I have data for more than 5 years, I would prefer a one-color plot.
Thank you for your help!
source
share