Issue
I have a pandas dataframe with this structure:
df_values
X | Y_A | Y_B
10 | 100 | 110
11 | 200 | 220
I would like to plot a trend that focuses on the relationship between Y_A
and Y_B
, to verify visually follow a similar function.
Currently, by trying sns.relplot(data=df_values)
I have the X
values plotted as well (I don't necessarily need them plotted as a line), any tips on how Seaborn could be used with this dataset for he purpose of showing the relationships between the trends? I am new to Seaborn so any ideas are very welcome!
Solution
Just divide one by the other and use that as your y
import pandas as pd
import seaborn as sns
df = pd.DataFrame({'X':[1,2,3,4],'Y_A':[100,200,300,400],'Y_B':[110,220,330,440]})
df['y_ratio'] = df['Y_A'] / df['Y_B']
sns.lineplot(data=df, x='X',y='y_ratio');
Answered By - Chris
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.