I am dealing with the following data frame (for illustration purposes only, the actual df is quite large):
seq x1 y1
0 2 0.7725 0.2105
1 2 0.8098 0.3456
2 2 0.7457 0.5436
3 2 0.4168 0.7610
4 2 0.3181 0.8790
5 3 0.2092 0.5498
6 3 0.0591 0.6357
7 5 0.9937 0.5364
8 5 0.3756 0.7635
9 5 0.1661 0.8364
Trying to build a multi-line graph for the above coordinates (x as "x1 versus y as" y1 ").
Lines with the same "seq" are the same path and must be built as one separate line, like all x, y coordinates corresponding to seq = 2, belong to one line, etc.
I can build them, but on separate graphs I want all the lines to be on the same graph using subheadings , but it didn’t work out correctly.
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib notebook
df.groupby("seq").plot(kind = "line", x = "x1", y = "y1")
This creates 100 graphs (which equals the number of unique seqs). Suggest me a way to get all the lines in one chart.
** UPDATE *
To solve this problem, I executed the following code:
fig, ax = plt.subplots(figsize=(12,8))
df.groupby('seq').plot(kind='line', x = "x1", y = "y1", ax = ax)
plt.title("abc")
plt.show()
. seq = 2 5 1; seq = 3 .
, 1, 1 2, .
?