0

I have to plot a Time Series given every 15 minutes with specific average prices for every 15 min intervals that means 96 intervals:

x-axis y-axis
00:00-00:15 price_1
00:15-00:30 price_2 . . . . 23:45-00:00 price_96

I want to plot the x-axis by every two hours: For example all price values from 00:00-2:00, 2:00-4:00,...22:00-24:00 by 2 hours (see picture).

Time series by 2 hours

I tried to solve the poblem with ggplot but couldn´t find a solution.

stefan
  • 90,330
  • 6
  • 25
  • 51
Mar
  • 1
  • 2
  • 1
    Welcome to SO! It would be easier to help you if you provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including the code you have tried and a snippet of your data in a reproducible fashion, e.g. using `dput()`. – stefan Jul 13 '23 at 19:14
  • 2
    When you write "I want to plot the x-axis by every two hours," do you mean you want to show all the 15-min prices, with axis labels every two hours? `scale_x_datetime(date_breaks = "2 hours", date_labels = "%H:%M")` would work if you can convert your time variable to POSIXct datetimes. Or you might look at the `hms` package for a time-of-day data type. – Jon Spring Jul 13 '23 at 22:43

0 Answers0