0

a total inexpert here trying to learn.I want to make a multi-line graph using matplotlib or seaborn where the data is grouped as follows:

    X1 X2 X3
0   10 20 30
1   0  16 40
2   10 60 80
3   20 20 90

The idea is to plot the three points and have them connected by a line, being the x-axis equal to X1, X2, X3 (column labels) and the y-axis as the row values. I couldn't find any answer to this problem anywhere. Thank you very much in advance for the answers!

3
  • Is your data a pandas DataFrame? A CSV file? Commented Sep 28, 2020 at 18:02
  • You said three points, what are they from your sample data? Commented Sep 28, 2020 at 18:05
  • Yes it is a dataframe, and the three points correspond to the three values by each row, e.g. first point (X1,10), second (X2,20), third (X3,30). Commented Sep 28, 2020 at 18:08

1 Answer 1

1

Do you mean:

df.T.plot()

Output:

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

@SEBASTIAN you're welcome. If it helps, please consider upvote/accept the answer.

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.