How do I display dates on x-axis only when the date changes in ggplot?

Viewed 25
        order_dates            Value
1     2022-08-27 00:00:10       80.9 
2     2022-08-27 00:16:40       81.6   
3     2022-08-27 00:33:28       81.2
4     2022-08-27 05:37:12       81.4
5     2022-08-28 08:52:24       89.0    
6     2022-08-28 09:50:28       100.6   
7     2022-08-28 12:30:08       84.9

I would like to plot this data and display all times on the x-axis, however, I'd like to display the date once for every instance the date changes. So I would have a date marker corresponding to row 1 and row 5. How can I achieve this?

1 Answers
ggplot(df,aes(order_dates,Value)) + 
geom_line() + 
scale_x_datetime(labels = date_format("%Y-%m-%d"), date_breaks = "day") 
Related