-1

Similar to Ploting Time Series Data with all the time stamp labeled in python

The data set has Time Stamp to 30 Second Resolution, When Ploting, how to specify to mark a X label in every hourly interval.

img

img

CAPSLOCK
  • 6,243
  • 3
  • 33
  • 56
user2458922
  • 1,691
  • 1
  • 17
  • 37
  • do not post images of the dataset. Post the data itself. Read [this](https://stackoverflow.com/help/how-to-ask) and [this](https://stackoverflow.com/help/minimal-reproducible-example) and then modify your question please. – CAPSLOCK Jul 05 '19 at 08:16

1 Answers1

-1

Use xticks.

times = [0, 30, 60, 90, 120, ...]
filtered_times = times[::120] # Skip 60 minutes at a time
xticks(filtered_times, map(str, filtered_times))
fizzybear
  • 1,197
  • 8
  • 22
  • Could you please explain what is ticks,**kwargs, and what is times = [0, 30, 60, 90, 120, ...] .. Could we use time = df.index.values ? I got ticks not defined error. – user2458922 Jul 04 '19 at 20:50
  • times is an array containing the sorted time values in seconds. Yes, if it is sorted and in seconds. – fizzybear Jul 04 '19 at 20:53
  • You can ignore **kwargs. It's just a way to take keyword arguments like plt.plot(x, y, size=2) – fizzybear Jul 04 '19 at 20:54
  • Lets say if I have 5 hours data, then I need to populate time [0,30,60,..... till 60*60*5] is it. ? – user2458922 Jul 04 '19 at 20:58
  • Yeah. If the data is already in the dataframe, then you can sort it with https://stackoverflow.com/questions/37787698/how-to-sort-pandas-dataframe-from-one-column – fizzybear Jul 04 '19 at 20:59