I have a big dataframe days.data made of energy consumption observations over several weeks. That df is a rbind of several days, where each day has the same amount of rows (60*60*24). Where each row is an energy observation. From that big df, I selected two days i.data, to investigate the consumption.
df <- days.data[i.data,] %>%
  mutate(date = as.factor(as.Date(time,tz="CET")))%>%
  select( time, kWh, date)
df$csum <- ave(df$kWh, df$date, FUN=cumsum)
ggplot(df, aes(x = time, y = csum)) + 
  geom_line(aes(color = date, linetype = date)) +
  scale_color_manual(values = c("darkred", "steelblue")) +
  scale_x_datetime(
    breaks = seq(df[1,1],
                 df[nrow(df),1], 36000),
    labels = date_format(format="%H:%M", tz = "CET"),
    expand = c(0, 0))  
So far so good, the plot looks not so bad.
The thing is, I would like to have both graphs together, not with one week in between... As both days have the same size this should be possible. 
As soon as I try to use #df$time <- as.numeric(strftime(df$time,"%H:%M", tz = "CET")) ggplot tells me I have discret values, …  I need something like that, but with both graphs:
Here a summary of my data (df made of 172800 rows...)
> summary(df)
      time                          kWh                    date            csum      
 Min.   :2020-03-20 00:00:00   Min.   :0.0000000   2020-03-20:86400   Min.   : 0.00  
 1st Qu.:2020-03-20 11:59:59   1st Qu.:0.0000000   2020-03-27:86400   1st Qu.: 0.00  
 Median :2020-03-23 23:59:59   Median :0.0000000                      Median :47.15  
 Mean   :2020-03-23 23:59:59   Mean   :0.0008111                      Mean   :36.78  
 3rd Qu.:2020-03-27 11:59:59   3rd Qu.:0.0000000                      3rd Qu.:69.43  
 Max.   :2020-03-27 23:59:59   Max.   :0.0881141                      Max.   :70.73  
> head(df)
                 time kWh       date csum
1 2020-03-20 00:00:00   0 2020-03-20    0
2 2020-03-20 00:00:01   0 2020-03-20    0
3 2020-03-20 00:00:02   0 2020-03-20    0
4 2020-03-20 00:00:03   0 2020-03-20    0
5 2020-03-20 00:00:04   0 2020-03-20    0
6 2020-03-20 00:00:05   0 2020-03-20    0
> 
What can I try next?


 
     
    
