Home > Mobile >  plot time series with regular intervals
plot time series with regular intervals

Time:08-09

I have video event data with timestamps and duration for each event. I am trying to visualize the data using excel. And open to use Python or any other language. Right now it is hard to visualize duration in plot for each event. My event is binary. Please suggest how can I update it such that it reflects duration. Thanks!

csv data

Events Plot

CodePudding user response:

Use a step plot with the cumsum duration as x-axis:

import matplotlib.pyplot as plt

plt.step(df['Duration'].cumsum(), df['Event'])

NB. here the x-axis is in the unit of "Duration".

output:

step plot

  • Related