How can I transform this dataframe in order to print it with seaborn ( lineplot )?

Viewed 130

I have a dataframe like the following:

In [0]: df.head()
Out[0]:

    airfield   airplane_cabin   airport_terminal   alcove
0       0.0            0.00              0.00     0.0
1       0.0            0.00              0.01     0.0
2       0.02           0.00              0.00     0.03
3       0.0            0.00              0.00     0.0
4       0.0            0.01              0.00     0.0

, where each row is a frame of a video containing the probabilities for each of the classes (I have more than 4 classes in real problem and that is why they are so low here). What I would like would be to print a lineplot where I can have the four frames on the X-axis and all the unique probabilities on the Y-axis. Then I would like to have different lines for each of the four classes. Something like in the following picture:

example

, where "signal" would be all the different unique probabilities; "timepoint" would be the frame number; and "event" would be the different classes, being "stim" and "cue" what "airfield" and "airplane_cabin" are in our example.

I hope the question is clear and thank you a lot for your help in advance!

Best,

1 Answers

Wouldn't it just be:

sns.lineplot(data=df)
plt.xlabel('frame number')
plt.ylabel('probability')

Output:

fig

Related