0

I'm trying to plot a multi line-graph plot from a pandas dataframe using seaborn. Below is a .csv of the of the data and the desired plot. In excel I simply selected the whole dataset and swapped the axis. Technically there are 110 lines (rows) on this, but many aren't visible because they only contain 0's.

Multi-line plot with 16 bins

This is my code:

individual_burst_data = {'nb001':nb001, 'nb002':nb002, 'nb003':nb003, 'nb004':nb004, 'nb005':nb005, 'nb006':nb006, 'nb007':nb007, 'nb008':nb008, 'nb009':nb009, 'nb010':nb010, 'nb011':nb011, 'nb012':nb012, 'nb013':nb013, 'nb015':nb015, 'nb016':nb016 }
ibd_panda_conv = pd.DataFrame(individual_burst_data)

sns.lineplot(data = ibd_panda_conv, x = individual_burst_data, y =ibd_panda_conv)

Other sources seem to only extract one column, whereas I need all the columns.

I tried to create an index for the y-axis

index_data = list(range(0,len(individual_burst_data)))

but this didn't work either.

1 Answer 1

1

The seaborn lineplot() documentation says:

Passing the entire wide-form dataset to data plots a separate line for each column

Since you want a line for each row instead, you need to transpose your dataframe, so try this:

sns.lineplot(data=ibd_panda_conv.T, dashes=False)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.