I have this panda dataframe:
0 music 0.00 9.02
1 female 9.02 152.70
2 music 152.70 155.12
3 female 155.12 206.82
4 noEnergy 206.82 208.10
basically an ID, TYPE, START, END
All this event are in sequence, so they cannot overlap.
My goal is to obtain a graph to show it sequence for the event duration, like
this:
Basically I want to "interpolate" the "music" type from 0 to 9.02, "female" to 9.02 to 152.70, and so on.
using this code:
# Read data from RTTM files into data frames
import matplotlib.pyplot as plt
import numpy as np
df1 = pd.read_csv('file.rttm', sep=' ', names=['type', 'start', 'end'])
df1.plot(x='start', y='type', kind='scatter', rot='vertical')
plt.show()
This only show the start position in time.
If I plot using this:
df1['duration'] = (df1['end'] - df1['start'])
plt.plot(df1['start'], df1['type'])
plt.show()
That once again is not what I would like to visualize. Any suggestion on right way to visualize it? Thx