In the following plot I wanted to remove the date and keep the time in hours. I have seen few solutions like here and another where Time is converted to numeric. I liked the use of require(scales)
ggplot(data= dfweek2, aes(x = Time, y = Mean_steps)) + facet_grid(day ~.) + geom_path()
this is my plot
When I change to
require(scales)
ggplot(data= dfweek2, aes(x = Time, y = Mean_steps)) + facet_grid(day ~.) + geom_path() + scale_x_datetime(labels = date_format("%H:%M"))
this scale is not longer correct...
What am I doing wrong?
> str(dfweek2)
Classes ‘grouped_df’, ‘tbl_df’, ‘tbl’ and 'data.frame': 576 obs. of 4 variables:
$ day : Factor w/ 2 levels "Weekday","Weekend": 1 1 1 1 1 1 1 1 1 1 ...
$ interval : int 0 5 10 15 20 25 30 35 40 45 ...
$ Mean_steps: num 2.333 0.462 0.179 0.205 0.103 ...
$ Time : POSIXct, format: "2015-06-15 00:00:00" "2015-06-15 00:05:00" ...